147 references to ERR_IllegalStatement
Microsoft.CodeAnalysis.CSharp (3)
Binder\Binder_Statements.cs (2)
659Error(diagnostics, ErrorCode.ERR_IllegalStatement, syntax); 3498Error(diagnostics, ErrorCode.ERR_IllegalStatement, syntax);
Errors\ErrorFacts.cs (1)
780or ErrorCode.ERR_IllegalStatement
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (7)
CodeGen\CodeGenAsyncIteratorTests.cs (2)
8745Diagnostic(ErrorCode.ERR_IllegalStatement, "Task.CompletedTask").WithLocation(13, 19)); 8811Diagnostic(ErrorCode.ERR_IllegalStatement, "Task.CompletedTask").WithLocation(12, 19));
CodeGen\CodeGenAsyncMethodBuilderOverrideTests.cs (1)
293Diagnostic(ErrorCode.ERR_IllegalStatement, "b ? await Task.Yield() : await Task.Yield()").WithLocation(21, 39)
CodeGen\CodeGenAsyncTests.cs (1)
5757Diagnostic(ErrorCode.ERR_IllegalStatement, "b ? await Task.Delay(1) : await Task.Delay(2)").WithLocation(8, 9)
CodeGen\CodeGenDeconstructTests.cs (1)
7551Diagnostic(ErrorCode.ERR_IllegalStatement, "(int x1, string x2)").WithLocation(6, 9),
CodeGen\CodeGenTupleTest.cs (2)
16202Diagnostic(ErrorCode.ERR_IllegalStatement, "(x, x)").WithLocation(6, 9) 16353Diagnostic(ErrorCode.ERR_IllegalStatement, "(1, 1)").WithLocation(6, 9)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (26)
PartialEventsAndConstructorsTests.cs (3)
57Diagnostic(ErrorCode.ERR_IllegalStatement, "new()").WithLocation(6, 24), 87Diagnostic(ErrorCode.ERR_IllegalStatement, "() => new()").WithLocation(2, 10) 123Diagnostic(ErrorCode.ERR_IllegalStatement, "new()").WithLocation(3, 20),
Semantics\CollectionExpressionTests.cs (6)
28040Diagnostic(ErrorCode.ERR_IllegalStatement, "[] + list").WithLocation(7, 9)); 28063Diagnostic(ErrorCode.ERR_IllegalStatement, "[]..").WithLocation(7, 9)); 28086Diagnostic(ErrorCode.ERR_IllegalStatement, "[] switch { null => 0 }").WithLocation(7, 9)); 28109Diagnostic(ErrorCode.ERR_IllegalStatement, "[] with { Count = 1, }").WithLocation(7, 9)); 28132Diagnostic(ErrorCode.ERR_IllegalStatement, "[] is object").WithLocation(7, 9)); 28155Diagnostic(ErrorCode.ERR_IllegalStatement, "[] as List<int>").WithLocation(7, 9));
Semantics\ExtensionTests.cs (2)
21105Diagnostic(ErrorCode.ERR_IllegalStatement, "object.P<int>").WithLocation(1, 1), 21114Diagnostic(ErrorCode.ERR_IllegalStatement, "object.P<>").WithLocation(2, 1),
Semantics\OutVarTests.cs (4)
9046Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(12, 23), 9061Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(17, 23), 9104Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(12, 23), 9119Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(17, 23),
Semantics\PatternMatchingTests.cs (1)
6184Diagnostic(ErrorCode.ERR_IllegalStatement, "z0").WithLocation(7, 31),
Semantics\PatternMatchingTests_Scope.cs (10)
1403Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(12, 23), 1418Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(17, 23), 1461Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(12, 23), 1476Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(17, 23), 2905Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(12, 29), 2917Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(18, 29), 2942Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(12, 29), 2957Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(18, 29), 3129Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(9, 29), 3135Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(11, 29),
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (8)
IOperation\IOperationTests_IDelegateCreationExpression.cs (4)
116Diagnostic(ErrorCode.ERR_IllegalStatement, "1").WithLocation(7, 36) 216Diagnostic(ErrorCode.ERR_IllegalStatement, "1").WithLocation(7, 45) 922Diagnostic(ErrorCode.ERR_IllegalStatement, "1").WithLocation(7, 47) 1382Diagnostic(ErrorCode.ERR_IllegalStatement, "1").WithLocation(7, 56)
IOperation\IOperationTests_IDynamicMemberReferenceExpression.cs (1)
288Diagnostic(ErrorCode.ERR_IllegalStatement, "d.GetValue<int, C1>").WithLocation(9, 23)
IOperation\IOperationTests_InvalidStatement.cs (2)
273Diagnostic(ErrorCode.ERR_IllegalStatement, "x").WithLocation(12, 21) 319Diagnostic(ErrorCode.ERR_IllegalStatement, "P").WithLocation(9, 24),
IOperation\IOperationTests_ITupleExpression.cs (1)
2250Diagnostic(ErrorCode.ERR_IllegalStatement, "(var ((a,b), c), int d)").WithLocation(6, 19),
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (1)
ScriptTests.cs (1)
1083Diagnostic(ErrorCode.ERR_IllegalStatement, "new()").WithLocation(1, 16));
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (69)
Semantics\BindingAsyncTests.cs (2)
2538Diagnostic(ErrorCode.ERR_IllegalStatement, "test.Prop"), 2541Diagnostic(ErrorCode.ERR_IllegalStatement, "test[1]"),
Semantics\BindingTests.cs (2)
2920Diagnostic(ErrorCode.ERR_IllegalStatement, @"i. 2962Diagnostic(ErrorCode.ERR_IllegalStatement, @"i.
Semantics\DeconstructionTests.cs (14)
861Diagnostic(ErrorCode.ERR_IllegalStatement, "(a) => a").WithLocation(6, 9) 885Diagnostic(ErrorCode.ERR_IllegalStatement, "(a, b) => { }").WithLocation(6, 19) 4210Diagnostic(ErrorCode.ERR_IllegalStatement, "(var (a,b), var c, int d)").WithLocation(6, 9), 4354Diagnostic(ErrorCode.ERR_IllegalStatement, "(var (a,b), var c, int d)").WithLocation(2, 1) 4482Diagnostic(ErrorCode.ERR_IllegalStatement, "(var (_, _), var _, int _)").WithLocation(6, 9) 4610Diagnostic(ErrorCode.ERR_IllegalStatement, "(var (_, _), var _, int _)").WithLocation(2, 1) 5159Diagnostic(ErrorCode.ERR_IllegalStatement, "((var (a,b), var c), int d)").WithLocation(6, 9), 5312Diagnostic(ErrorCode.ERR_IllegalStatement, "((var (a,b), var c), int d)").WithLocation(2, 1) 5453Diagnostic(ErrorCode.ERR_IllegalStatement, "((var (_, _), var _), int _)").WithLocation(6, 9) 5590Diagnostic(ErrorCode.ERR_IllegalStatement, "((var (_, _), var _), int _)").WithLocation(2, 1) 5627Diagnostic(ErrorCode.ERR_IllegalStatement, "(var ((a,b), c), int d)").WithLocation(6, 9), 5746Diagnostic(ErrorCode.ERR_IllegalStatement, "(var ((a,b), c), int d)").WithLocation(2, 1) 5853Diagnostic(ErrorCode.ERR_IllegalStatement, "(var ((_, _), _), int _)").WithLocation(6, 9) 5953Diagnostic(ErrorCode.ERR_IllegalStatement, "(var ((_, _), _), int _)").WithLocation(2, 1)
Semantics\DelegateTypeTests.cs (1)
4968Diagnostic(ErrorCode.ERR_IllegalStatement, "0").WithLocation(18, 18),
Semantics\ExpressionBodiedMemberTests.cs (1)
447Diagnostic(ErrorCode.ERR_IllegalStatement, "(new object())").WithLocation(4, 25));
Semantics\ForEachTests.cs (1)
1932Diagnostic(ErrorCode.ERR_IllegalStatement, "i < 5").WithLocation(6, 18),
Semantics\ForLoopErrorTests.cs (2)
36Diagnostic(ErrorCode.ERR_IllegalStatement, "j > 5").WithLocation(6, 41)); 201new ErrorDescription { Code = (int)ErrorCode.ERR_IllegalStatement });
Semantics\ImplicitObjectCreationTests.cs (2)
1808Diagnostic(ErrorCode.ERR_IllegalStatement, "new(a) { x }").WithLocation(6, 9), 1820Diagnostic(ErrorCode.ERR_IllegalStatement, "new() { x }").WithLocation(7, 9),
Semantics\LambdaTests.cs (5)
205Diagnostic(ErrorCode.ERR_IllegalStatement, "1").WithLocation(54, 26), 701Diagnostic(ErrorCode.ERR_IllegalStatement, "1 / 0").WithLocation(9, 32), 754Diagnostic(ErrorCode.ERR_IllegalStatement, "new D(() => { })"), 757Diagnostic(ErrorCode.ERR_IllegalStatement, "new D(()=>{})")); 1462Diagnostic(ErrorCode.ERR_IllegalStatement, "(new object())").WithLocation(6, 41));
Semantics\LocalFunctionTests.cs (1)
3987Diagnostic(ErrorCode.ERR_IllegalStatement, "2").WithLocation(13, 20),
Semantics\NameOfTests.cs (2)
641Diagnostic(ErrorCode.ERR_IllegalStatement, "nameof(N)").WithLocation(7, 9) 666Diagnostic(ErrorCode.ERR_IllegalStatement, "nameof(N)").WithLocation(7, 9)
Semantics\NullableReferenceTypesTests.cs (9)
3408Diagnostic(ErrorCode.ERR_IllegalStatement, "new object[](x)!").WithLocation(8, 43), 3441Diagnostic(ErrorCode.ERR_IllegalStatement, "x!").WithLocation(6, 9), 3447Diagnostic(ErrorCode.ERR_IllegalStatement, "M2(x)!").WithLocation(7, 9), 3453Diagnostic(ErrorCode.ERR_IllegalStatement, "x!").WithLocation(11, 9), 3459Diagnostic(ErrorCode.ERR_IllegalStatement, "M(x)!").WithLocation(12, 9) 3688Diagnostic(ErrorCode.ERR_IllegalStatement, "i.").WithLocation(7, 31) 3760Diagnostic(ErrorCode.ERR_IllegalStatement, "(throw null!)!").WithLocation(5, 9), 161391Diagnostic(ErrorCode.ERR_IllegalStatement, "async (string s) => { try {} catch (System.Exception e) {} }").WithLocation(5, 1), 161415Diagnostic(ErrorCode.ERR_IllegalStatement, "async (string s) => { try {} catch (System.Exception e) {} }").WithLocation(5, 1),
Semantics\NullableReferenceTypesVsPatterns.cs (3)
2774Diagnostic(ErrorCode.ERR_IllegalStatement, @"test switch { { Inner1: """" } => """" }").WithLocation(14, 9), 2813Diagnostic(ErrorCode.ERR_IllegalStatement, @"test switch { { Next.Inner1: """" } => """" }").WithLocation(16, 9), 2850Diagnostic(ErrorCode.ERR_IllegalStatement, @"test switch { { Method: """" } => """" }").WithLocation(14, 9),
Semantics\NullConditionalAssignmentTests.cs (2)
959Diagnostic(ErrorCode.ERR_IllegalStatement, "*x?.F = 1").WithLocation(8, 9), 1016Diagnostic(ErrorCode.ERR_IllegalStatement, "*x?.F = 1").WithLocation(9, 9),
Semantics\RefFieldTests.cs (2)
22130Diagnostic(ErrorCode.ERR_IllegalStatement, "local").WithLocation(5, 22) 22160Diagnostic(ErrorCode.ERR_IllegalStatement, "local").WithLocation(5, 29)
Semantics\ScriptSemanticsTests.cs (1)
1077Diagnostic(ErrorCode.ERR_IllegalStatement, "i* i"));
Semantics\SemanticAnalyzerTests.cs (1)
167Diagnostic(ErrorCode.ERR_IllegalStatement, "x").WithLocation(6, 9));
Semantics\SemanticErrorTests.cs (12)
7842Diagnostic(ErrorCode.ERR_IllegalStatement, "checked(i++)")); 7862Diagnostic(ErrorCode.ERR_IllegalStatement, "(a) => a").WithLocation(6, 9), 7865Diagnostic(ErrorCode.ERR_IllegalStatement, "(a, b) => { }").WithLocation(7, 9), 7868Diagnostic(ErrorCode.ERR_IllegalStatement, "x + y").WithLocation(9, 9), 7871Diagnostic(ErrorCode.ERR_IllegalStatement, "x == 1").WithLocation(9, 16), 7896Diagnostic(ErrorCode.ERR_IllegalStatement, "(a) => a").WithLocation(6, 9), 7899Diagnostic(ErrorCode.ERR_IllegalStatement, "(a, b) => { }").WithLocation(7, 9), 7902Diagnostic(ErrorCode.ERR_IllegalStatement, "x + y").WithLocation(9, 9), 7905Diagnostic(ErrorCode.ERR_IllegalStatement, "x == 1").WithLocation(9, 16), 24669Diagnostic(ErrorCode.ERR_IllegalStatement, "x?.Length").WithLocation(8, 9), 24672Diagnostic(ErrorCode.ERR_IllegalStatement, "x?[1]").WithLocation(9, 9), 24675Diagnostic(ErrorCode.ERR_IllegalStatement, "x?.ToString()[1]").WithLocation(10, 9)
Semantics\StackAllocInitializerTests.cs (6)
884Diagnostic(ErrorCode.ERR_IllegalStatement, "stackalloc[] {1}").WithLocation(6, 9), 887Diagnostic(ErrorCode.ERR_IllegalStatement, "stackalloc int[] {1}").WithLocation(7, 9), 890Diagnostic(ErrorCode.ERR_IllegalStatement, "stackalloc int[1] {1}").WithLocation(8, 9) 2708Diagnostic(ErrorCode.ERR_IllegalStatement, "stackalloc X[new(), new()]").WithLocation(1, 1), 2751Diagnostic(ErrorCode.ERR_IllegalStatement, "stackalloc X[0, new(out x)]").WithLocation(2, 1), 2780Diagnostic(ErrorCode.ERR_IllegalStatement, $"stackalloc X[0, {expr}]").WithLocation(1, 1),
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (33)
Parsing\FileModifierParsingTests.cs (2)
2143Diagnostic(ErrorCode.ERR_IllegalStatement, "file").WithLocation(1, 1) 2177Diagnostic(ErrorCode.ERR_IllegalStatement, "file").WithLocation(1, 1)
Parsing\ParserErrorMessageTests.cs (3)
714Diagnostic(ErrorCode.ERR_IllegalStatement, "m").WithLocation(8, 20), 738Diagnostic(ErrorCode.ERR_IllegalStatement, "e").WithLocation(11, 16), 4683Diagnostic(ErrorCode.ERR_IllegalStatement, "30").WithLocation(7, 34)
Parsing\RawInterpolatedStringLiteralCompilingTests.cs (1)
456Diagnostic(ErrorCode.ERR_IllegalStatement, @"$"""""" """"""").WithLocation(6, 9));
Parsing\RawStringLiteralCompilingTests.cs (1)
381Diagnostic(ErrorCode.ERR_IllegalStatement, @""""""" """"""").WithLocation(6, 9));
Parsing\StatementAttributeParsingTests.cs (26)
3498Diagnostic(ErrorCode.ERR_IllegalStatement, "delegate () { }").WithLocation(6, 12)); 3580Diagnostic(ErrorCode.ERR_IllegalStatement, "() => { }").WithLocation(6, 12)); 3670Diagnostic(ErrorCode.ERR_IllegalStatement, "(int i) => { }").WithLocation(6, 12)); 3751Diagnostic(ErrorCode.ERR_IllegalStatement, "i => { }").WithLocation(6, 12)); 3825Diagnostic(ErrorCode.ERR_IllegalStatement, "new { }").WithLocation(6, 12)); 3918Diagnostic(ErrorCode.ERR_IllegalStatement, "new int[] { }").WithLocation(6, 12)); 4001Diagnostic(ErrorCode.ERR_IllegalStatement, "new [] { 0 }").WithLocation(6, 12)); 4418Diagnostic(ErrorCode.ERR_IllegalStatement, "a + a").WithLocation(6, 12)); 4507Diagnostic(ErrorCode.ERR_IllegalStatement, "(object)a").WithLocation(6, 12)); 4682Diagnostic(ErrorCode.ERR_IllegalStatement, "default(int)").WithLocation(6, 12)); 4757Diagnostic(ErrorCode.ERR_IllegalStatement, "default").WithLocation(6, 12)); 4852Diagnostic(ErrorCode.ERR_IllegalStatement, "s[0]").WithLocation(6, 12)); 4951Diagnostic(ErrorCode.ERR_IllegalStatement, "s?[0]").WithLocation(6, 12)); 5100Diagnostic(ErrorCode.ERR_IllegalStatement, "0").WithLocation(6, 12)); 5188Diagnostic(ErrorCode.ERR_IllegalStatement, "i.ToString").WithLocation(6, 12)); 5429Diagnostic(ErrorCode.ERR_IllegalStatement, "(1)").WithLocation(6, 12)); 5605Diagnostic(ErrorCode.ERR_IllegalStatement, "i").WithLocation(5, 14)); 5723Diagnostic(ErrorCode.ERR_IllegalStatement, "from c in s select c").WithLocation(7, 12)); 5826Diagnostic(ErrorCode.ERR_IllegalStatement, "a..b").WithLocation(6, 12), 5928Diagnostic(ErrorCode.ERR_IllegalStatement, "a..").WithLocation(6, 12)); 6021Diagnostic(ErrorCode.ERR_IllegalStatement, "[A]..b").WithLocation(6, 9), 6113Diagnostic(ErrorCode.ERR_IllegalStatement, "[A]..").WithLocation(6, 9), 6194Diagnostic(ErrorCode.ERR_IllegalStatement, "sizeof(int)").WithLocation(6, 12)); 6280Diagnostic(ErrorCode.ERR_IllegalStatement, "a switch { }").WithLocation(6, 12), 6364Diagnostic(ErrorCode.ERR_IllegalStatement, "typeof(int)").WithLocation(6, 12)); 6774Diagnostic(ErrorCode.ERR_IllegalStatement, "0").WithLocation(6, 31));