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