Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [Compiler tests] Adjusted tests for #1187 and #1191 * [Compiler tests] Added C877 and adjusted R882 for #1184 * [Compiler tests] Added C878 for #1194 (and missing C877 from previous commit) * [Common] Fixes #/issues/1194 * WIP on StackAlloc, debugger sequence points and line numbers in error messages * [Compiler tests] Added test C879 for #1195 * [Compiler] Switch to .Net Analyzers version 7.0.0 * [Compiler] Fixes #/issues/1195 Adjust overload resolution to only use our "logic" when: - functions are involved - our types are involved - param is passed by reference - argument is enum * [Compiler] Suppress error messages about updated NetAnalyzers. Also suppress NetAnalyzer all together for X# code * [Tests] Fixed one more test * Fixes #/issues/1184, C877 and R882 * [Tests] SUM command has been fixed in the header file * [Compiler] Fixes #/issues/1084 * [Tests] Added test for Stackalloc keyword * [Compiler] A predicate prevents STACKALLOC(123) from being parsed as STACKALLOC followed by a paren expression * [Compiler] Fixes #/issues/1166, issue number 1 * [Compiler] Fixes #/issues/1109 * [Tests] Added pragma to several tests to suppress messages about missing REF or OUT modifiers for parameters * [tests] Changed incorrect '.' operators to ':' in two tests * [tests] Updated STACKALLOC test to use STACKALLOC as an identifier for a local * [tests] Set compiler profile to debug tests Co-authored-by: cpyrgas <chris@xsharp.eu>
- Loading branch information
1 parent
4a11668
commit 80144f1
Showing
34 changed files
with
1,450 additions
and
937 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
// 129. Assertion failed at BetterConversionExpression... | ||
// using REF for the last argument gets rid of the failed assertion | ||
#pragma warnings(9071, off) // Parameter 3 needs a(n) 'Out' modifier. This modifier was automatically added. | ||
FUNCTION Start() AS VOID | ||
LOCAL n,m,k AS INT | ||
n := 1;m := 1;k := 1 | ||
? Math.DivRem( n, m, k ) | ||
? k | ||
|
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,32 @@ | ||
// 877. Problems with interpolated strings | ||
// https://github.com/X-Sharp/XSharpPublic/issues/1184 | ||
FUNCTION Start( ) AS VOID | ||
LOCAL n := 123 AS INT | ||
LOCAL c AS STRING | ||
c := i"{n}" | ||
? c | ||
xAssert(c == "123") | ||
|
||
c := i"{1}" | ||
? c | ||
xAssert(c == "1") | ||
|
||
c := i"{n} {{" | ||
? c | ||
xAssert(c == "123 {") | ||
|
||
c := i"{n} }}" | ||
? c | ||
xAssert(c == "123 }") | ||
|
||
c := i"{n} {{}}" | ||
? c | ||
xAssert(c == "123 {}") | ||
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,24 @@ | ||
// 878. Preprocessor problem with the SUM UDC (with nested brackets) | ||
|
||
FUNCTION Start() AS VOID | ||
LOCAL uSum1,uSum2 AS INT | ||
|
||
SUM 10 TO uSum1 WHILE 1==1 FOR "a"=="a" | ||
? uSum1 | ||
xAssert(uSum1 == 10) | ||
SUM 100,200 TO uSum1 , uSum2 WHILE TRUE FOR TRUE | ||
|
||
? uSum1, uSum2 | ||
xAssert(uSum1 == 100) | ||
xAssert(uSum2 == 200) | ||
|
||
FUNCTION DbEval(cb) | ||
Eval(cb) | ||
RETURN NIL | ||
|
||
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,18 @@ | ||
// 879. Compiler incorrectly selects constructor overload with OBJECT[] parameter | ||
// | ||
/* | ||
System.ArgumentException: Non white space characters cannot be added to content. | ||
at System.Xml.Linq.XDocument.ValidateString(String s) | ||
at System.Xml.Linq.XContainer.AddStringSkipNotify(String s) | ||
at System.Xml.Linq.XContainer.AddContentSkipNotify(Object content) | ||
*/ | ||
|
||
USING System.Xml.Linq | ||
|
||
FUNCTION Start( ) AS VOID | ||
LOCAL x AS XDocument | ||
x := XDocument{} | ||
x := XDocument{x} // this works fine | ||
x := XDocument{XDeclaration{"1.0", "utf-8", "False"}} // incorrect overload picked here | ||
? x:Declaration:Version | ||
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
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 |
---|---|---|
@@ -1,16 +1,20 @@ | ||
// https://github.com/X-Sharp/XSharpPublic/issues/1187 | ||
// https://github.com/X-Sharp/XSharpPublic/issues/1190 | ||
static class Test | ||
public static method GetVal() as logic | ||
local nAbc := 1 as int | ||
STATIC CLASS Test | ||
PUBLIC STATIC METHOD GetVal() AS LOGIC | ||
LOCAL nAbc := 1 AS INT | ||
|
||
if (nAbc > 0) // error here and not in the elseif line | ||
nop() | ||
elseif (self:nAbc == 0) | ||
nop() | ||
endif | ||
IF (nAbc > 0) // error here and not in the elseif line | ||
NOP() | ||
ELSEIF (SELF:nAbc == 0) | ||
NOP() | ||
ENDIF | ||
|
||
REPEAT | ||
? "test" | ||
UNTIL (unkonwn == 123) | ||
|
||
return true | ||
end class | ||
RETURN TRUE | ||
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 |
---|---|---|
@@ -1,5 +1,20 @@ | ||
// https://github.com/X-Sharp/XSharpPublic/issues/1184 | ||
function start as void | ||
var teststring := ie"{1}}" | ||
FUNCTION start AS VOID | ||
VAR teststring := ie"{1}}" | ||
? testString | ||
return | ||
|
||
testString := ie"{}" // An internal compiler error here | ||
// c# reports "error CS1733: Expected expression" | ||
RETURN | ||
|
||
/* | ||
R882.prg(1,1): error XS9999: An internal compiler error has occurred: 'Object reference not set to an instance of an object.', at LanguageService.CodeAnalysis.GreenNode.AdjustFlagsAndWidth(GreenNode node) in D:\a\XSharpDev\XSharpDev\Roslyn\Src\Compilers\Core\Portable\Syntax\GreenNode.cs:line 117 | ||
at LanguageService.CodeAnalysis.XSharp.Syntax.InternalSyntax.ArgumentSyntax..ctor(SyntaxKind kind, NameColonSyntax nameColon, SyntaxToken refKindKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) in D:\a\XSharpDev\XSharpDev\Roslyn\Src\Compilers\CSharp\Portable\Generated\CSharpSyntaxGenerator\CSharpSyntaxGenerator.SourceGenerator\Syntax.xml.Internal.Generated.cs:line 5576 | ||
at LanguageService.CodeAnalysis.XSharp.Syntax.InternalSyntax.ContextAwareSyntax.Argument(NameColonSyntax nameColon, SyntaxToken refKindKeyword, ExpressionSyntax expression) in D:\a\XSharpDev\XSharpDev\Roslyn\Src\Compilers\CSharp\Portable\Generated\CSharpSyntaxGenerator\CSharpSyntaxGenerator.SourceGenerator\Syntax.xml.Internal.Generated.cs:line 35293 | ||
at LanguageService.CodeAnalysis.XSharp.Syntax.InternalSyntax.XSharpTreeTransformationCore.CreateInterPolatedStringExpression(IToken token, XSharpParserRuleContext context) in D:\a\XSharpDev\XSharpDev\XSharp\src\Compiler\XSharpCodeAnalysis\Parser\XSharpTreeTransformationCore.cs:line 8988 | ||
at LanguageService.CodeAnalysis.XSharp.Syntax.InternalSyntax.XSharpTreeTransformationCore.ExitLiteralValue(LiteralValueContext context) in D:\a\XSharpDev\XSharpDev\XSharp\src\Compiler\XSharpCodeAnalysis\Parser\XSharpTreeTransformationCore.cs:line 9106 | ||
at LanguageService.CodeAnalysis.XSharp.SyntaxParser.XSharpParser.LiteralValueContext.ExitRule(IParseTreeListener listener) in D:\a\XSharpDev\XSharpDev\XSharp\src\Compiler\XSharpCodeAnalysis\Generated\XSharpParser.cs:line 20941 | ||
at LanguageService.SyntaxTree.Tree.ParseTreeWalker.ExitRule(IParseTreeListener listener, IRuleNode r) in D:\a\XSharpDev\XSharpDev\XSharp\src\Compiler\XSharpCodeAnalysis\Antlr4.Runtime\Tree\ParseTreeWalker.cs:line 95 | ||
at LanguageService.SyntaxTree.Tree.ParseTreeWalker.Walk(IParseTreeListener listener, IParseTree t) in D:\a\XSharpDev\XSharpDev\XSharp\src\Compiler\XSharpCodeAnalysis\Antlr4.Runtime\Tree\ParseTreeWalker.cs:line 54 | ||
at LanguageService.CodeAnalysis.XSharp.Syntax.InternalSyntax.XSharpLanguageParser.ParseCompilationUnitCore() in D:\a\XSharpDev\XSharpDev\XSharp\src\Compiler\XSharpCodeAnalysis\Parser\XSharpLanguageParser.cs:line 395 | ||
*/ |
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 |
---|---|---|
@@ -1,14 +1,39 @@ | ||
FUNCTION Start() AS VOID STRICT | ||
VAR x := StackAlloc<DWORD>(10) | ||
LOCAL dim y[10] as dword | ||
? @x | ||
? @y | ||
VAR x := StackAlloc <dword>{1,2,3,4,5,6,7,8,9,10} | ||
VAR y := StackAlloc dword[]{10} | ||
//var z := STACKALLOC 10 | ||
local STACKALLOC := "sometext" as string | ||
? STACKALLOC | ||
xAssert(x[1] == 1) | ||
xAssert(x[10] == 10) | ||
? x[1], x[2], x[3], x[4] | ||
? y[1], y[2], y[3], y[4] | ||
y[1] := x[1] := 42 | ||
y[2] := x[2] := 42*42 | ||
x[3] := 42 * x[2] | ||
y[4] := x[4] := 42 * x[3] | ||
? x[1], x[2], x[3], x[4] | ||
? y[1], y[2], y[3], y[4] | ||
Console.Read() | ||
xAssert(x[1] == 42) | ||
xAssert(y[1] == 42) | ||
xAssert(x[4] == 42*42*42*42) | ||
xAssert(y[4] == 42*42*42*42) | ||
? @x | ||
for var i := 1 to 10 | ||
? i, @x[i], x[i] | ||
next | ||
? " outside of boundaries, no exception, this may be dangerous" | ||
|
||
for var i := 11 to 20 | ||
? i, @x[i], x[i] | ||
next | ||
return | ||
|
||
|
||
PROC xAssert(l AS LOGIC) AS VOID | ||
IF l | ||
? "Assertion passed" | ||
ELSE | ||
THROW Exception{"Incorrect result"} | ||
END IF | ||
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
Oops, something went wrong.