-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'remotes/origin/feature/xSharpCompiler'
- Loading branch information
Showing
97 changed files
with
4,498 additions
and
2,185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// Dummy file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// 748. error XS1628: Cannot use ref, out, or in parameter 'n' inside an anonymous method, lambda expression, query expression, or local function | ||
FUNCTION Start() AS VOID | ||
LOCAL n := 1 AS INT | ||
TestClass.TestMethod(REF n) | ||
? n | ||
xAssert(n == 2) | ||
|
||
PUBLIC CLASS TestClass | ||
// error XS1628: Cannot use ref, out, or in parameter 'n' inside an anonymous method, lambda expression, query expression, or local function | ||
STATIC METHOD TestMethod(n REF INT) AS VOID | ||
n := 2 | ||
END CLASS | ||
|
||
|
||
PROC xAssert(l AS LOGIC) | ||
IF .not. l | ||
THROW Exception{"Incorrect result in line " + System.Diagnostics.StackTrace{TRUE}:GetFrame(1):GetFileLineNumber():ToString()} | ||
END IF | ||
? "Assertion passed" | ||
RETURN | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
FUNCTION Start() AS VOID | ||
|
||
LOCAL cFileName AS STRING | ||
|
||
LOCAL aStruct AS ARRAY | ||
|
||
cFileName := "memotest" | ||
|
||
RddSetDefault("DBFCDX") | ||
|
||
aStruct := { ; | ||
{ "MEMO1","M",0,0 } ,; | ||
{ "MEMO2","M",1,0 } ,; | ||
{ "MEMO3","M",10,0 } ,; | ||
{ "MEMO4","M",111,0 } ; | ||
} | ||
|
||
DbCreate(cFileName,aStruct) | ||
|
||
DbUseArea(,,cFileName) | ||
|
||
DbAppend() | ||
|
||
FieldPut(1,"memo1") | ||
|
||
FieldPut(2,"memo2") | ||
|
||
FieldPut(3,"memo3") | ||
|
||
FieldPut(4,"memo4") | ||
|
||
XAssert(FieldGet(1) == "memo1") | ||
XAssert(FieldGet(2) == "memo2") | ||
XAssert(FieldGet(3) == "memo3") | ||
XAssert(FieldGet(4) == "memo4") | ||
|
||
DbCloseArea() | ||
PROC xAssert(l AS LOGIC) | ||
IF .not. l | ||
THROW Exception{"Incorrect result in line " + System.Diagnostics.StackTrace{TRUE}:GetFrame(1):GetFileLineNumber():ToString()} | ||
END IF | ||
? "Assertion passed" | ||
RETURN | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// R744 Constructor Chaining | ||
// the constructor inside TestInherited1 calls the parameterless constructor of System.Object | ||
// and skips the constructors of the Test level. So the field val is not initialized. | ||
FUNCTION Start() AS VOID STRICT | ||
Console.WriteLine("No initialization of fields. No Warning or error of invalid super call") | ||
TestInherited1{""} | ||
|
||
Console.WriteLine("Initialization of fields in the base class is called after the Super call") | ||
|
||
TestInherited2{""} | ||
|
||
Wait | ||
|
||
RETURN | ||
|
||
CLASS Test | ||
|
||
HIDDEN val := "initialized" AS STRING | ||
|
||
PROTECTED METHOD Print() AS VOID STRICT | ||
Console.WriteLine(val) | ||
|
||
RETURN | ||
|
||
CONSTRUCTOR(test1 AS STRING) AS VOID STRICT | ||
Print() | ||
RETURN | ||
|
||
|
||
CONSTRUCTOR(test1 AS LONG) AS VOID STRICT | ||
Print() | ||
RETURN | ||
|
||
|
||
END CLASS | ||
|
||
CLASS TestInherited1 INHERIT Test | ||
|
||
CONSTRUCTOR(test1 AS STRING) AS VOID STRICT | ||
|
||
Print() | ||
|
||
|
||
SUPER() //invalid super call. This should report an error | ||
|
||
RETURN | ||
|
||
END CLASS | ||
|
||
CLASS TestInherited2 INHERIT Test | ||
|
||
CONSTRUCTOR(test1 AS STRING) AS VOID STRICT | ||
|
||
Print() | ||
|
||
SUPER(test1) | ||
|
||
RETURN | ||
|
||
END CLASS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// R747. System.ExecutionEngineException | ||
// Problem happens only with /vo11+ enabled and when the target is set to x86 | ||
// https://github.com/X-Sharp/XSharpPublic/issues/511 | ||
FUNCTION Start( ) AS VOID | ||
LOCAL dNullable AS Nullable<Decimal> | ||
LOCAL dValue AS Decimal | ||
|
||
dNullable := 1m | ||
// | ||
dValue := dNullable:Value // ok | ||
? dValue | ||
xAssert(dValue == 1m) | ||
|
||
dValue := (Decimal)dNullable // ok | ||
? dValue | ||
xAssert(dValue == 1m) | ||
|
||
// Note that c# does not allow this syntax at all, requires a cast or using :Value | ||
dValue := dNullable // System.ExecutionEngineException | ||
? dValue | ||
xAssert(dValue == 1m) | ||
RETURN | ||
|
||
PROC xAssert(l AS LOGIC) | ||
IF .not. l | ||
THROW Exception{"Incorrect result in line " + System.Diagnostics.StackTrace{TRUE}:GetFrame(1):GetFileLineNumber():ToString()} | ||
END IF | ||
? "Assertion passed" | ||
RETURN | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
FUNCTION Start( ) AS VOID | ||
? "Hello" | ||
LOCAL l = GetDesktopWindow() | ||
xAssert(l!= 0) | ||
VAR sb := System.Text.StringBuilder{255} | ||
XAssert(GetSystemDirectory(sb, sb.Capacity+1) != 0) | ||
? sb.ToString() | ||
xAssert(sb.ToString().ToLower().Contains("system32")) | ||
WAIT | ||
RETURN | ||
|
||
|
||
|
||
DECLARE INTEGER GetActiveWindow IN user32 | ||
DECLARE INTEGER GetDesktopWindow IN user32 | ||
DECLARE INTEGER MessageBox IN USER32 INTEGER , STRING , STRING , LONG | ||
DECLARE INTEGER GetSystemDirectoryA IN Kernel32 AS GetSystemDirectory System.Text.StringBuilder buffer, LONG numchars | ||
// declaration with STRING @ will generate a compiler error | ||
//DECLARE INTEGER GetSystemDirectory IN Kernel32 STRING @, LONG | ||
|
||
|
||
PROC xAssert(l AS LOGIC) | ||
IF .not. l | ||
THROW Exception{"Incorrect result in line " + System.Diagnostics.StackTrace{TRUE}:GetFrame(1):GetFileLineNumber():ToString()} | ||
END IF | ||
? "Assertion passed" | ||
RETURN |
Oops, something went wrong.