107 references to ERR_ConstantExpected
Microsoft.CodeAnalysis.CSharp (8)
Binder\Binder_Expressions.cs (2)
3738
Error(diagnostics, ErrorCode.
ERR_ConstantExpected
, size.Syntax);
3975
Error(diagnostics, ErrorCode.
ERR_ConstantExpected
, sizeOpt.Syntax);
Binder\Binder_InterpolatedString.cs (1)
117
diagnostics.Add(ErrorCode.
ERR_ConstantExpected
, interpolation.AlignmentClause.Value.Location);
Binder\Binder_Patterns.cs (1)
560
diagnostics.Add(ErrorCode.
ERR_ConstantExpected
, patternExpression.Location);
Binder\SwitchBinder.cs (1)
503
diagnostics.Add(ErrorCode.
ERR_ConstantExpected
, node.Location);
Errors\ErrorFacts.cs (1)
675
case ErrorCode.
ERR_ConstantExpected
:
Parser\LanguageParser.cs (2)
5306
? this.ParseIdentifierName(ErrorCode.
ERR_ConstantExpected
)
9159
ParseIdentifierName(ErrorCode.
ERR_ConstantExpected
),
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (1)
CodeGen\SwitchTests.cs (1)
2628
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "i").WithLocation(8, 18)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (36)
Diagnostics\OperationAnalyzerTests.cs (2)
281
Diagnostic(ErrorCode.
ERR_ConstantExpected
, ":").WithLocation(44, 18))
1078
Diagnostic(ErrorCode.
ERR_ConstantExpected
, ":").WithLocation(41, 18))
Semantics\PatternMatchingTests.cs (18)
3226
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "typeof(string)").WithLocation(9, 18),
3229
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "typeof(string[])").WithLocation(12, 18)
4386
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "_").WithLocation(12, 18)
4668
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "M").WithLocation(10, 18),
4671
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "(int)M()").WithLocation(11, 19)
4698
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "M").WithLocation(8, 18)
4721
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "M").WithLocation(6, 21)
4820
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "true ? x3 : 4").WithLocation(9, 18),
8694
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "null").WithLocation(5, 58),
8767
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "null").WithLocation(5, 63));
10294
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "null").WithLocation(5, 50),
10367
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "null").WithLocation(5, 55));
10703
Diagnostic(ErrorCode.
ERR_ConstantExpected
, @"$""{123}""").WithLocation(5, 56),
10706
Diagnostic(ErrorCode.
ERR_ConstantExpected
, @"$""{n}""").WithLocation(6, 48));
10752
Diagnostic(ErrorCode.
ERR_ConstantExpected
, @"b ? """" : ""ABC""").WithLocation(4, 65),
10755
Diagnostic(ErrorCode.
ERR_ConstantExpected
, @"b ? """" : ""123""").WithLocation(5, 57));
10800
Diagnostic(ErrorCode.
ERR_ConstantExpected
, @"b switch { true => """", false => ""ABC"" }").WithLocation(4, 64),
10803
Diagnostic(ErrorCode.
ERR_ConstantExpected
, @"b switch { false => """", true => ""123"" }").WithLocation(5, 56));
Semantics\PatternMatchingTests_Scope.cs (1)
5199
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "y10").WithLocation(89, 18),
Semantics\PatternMatchingTests3.cs (2)
1865
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "goto case (string str, decimal[] arr);").WithLocation(9, 17),
5878
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "a").WithLocation(5, 18),
Semantics\PatternMatchingTests4.cs (11)
60
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "default(T)").WithLocation(8, 18));
100
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "M2").WithLocation(15, 18),
103
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "M2").WithLocation(18, 18));
112
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "M1").WithLocation(6, 18),
118
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "M1").WithLocation(9, 18),
121
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "M2").WithLocation(15, 18),
124
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "M2").WithLocation(18, 18));
162
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "stackalloc int[1] { 0 }").WithLocation(10, 18),
165
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "new { X = 0 }").WithLocation(12, 18)
3273
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "goto case string.Empty.Length;").WithLocation(10, 21)
3441
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "1").WithLocation(6, 18),
Semantics\PatternMatchingTests5.cs (1)
1073
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "s->X").WithLocation(6, 18)
Semantics\PatternSwitchTests.cs (1)
1888
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "new object() is int x1").WithLocation(8, 18),
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (24)
IOperation\IOperationTests_ArrayCreationAndInitializer.cs (8)
291
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "dimension").WithLocation(6, 38)
1321
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "d1 ?? d2").WithLocation(8, 22)
1542
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "d1 ?? d2").WithLocation(8, 25)
1693
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "d1 ?? d2").WithLocation(7, 22),
1696
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "d3 ?? d4").WithLocation(7, 32)
2803
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "d1 ?? d2").WithLocation(7, 22)
3041
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "d1 ?? d2").WithLocation(7, 22),
3044
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "d3 ?? d4").WithLocation(7, 32)
IOperation\IOperationTests_IInterpolatedStringOperation.cs (1)
1347
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "(a ? b : c)").WithLocation(8, 18)
IOperation\IOperationTests_IIsPatternExpression.cs (1)
344
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "y").WithLocation(8, 28)
IOperation\IOperationTests_IPatternSwitchCase.cs (2)
425
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "x is true").WithLocation(9, 28)
487
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "typeof(X)").WithLocation(9, 28)
IOperation\IOperationTests_ISwitchExpression.cs (1)
1410
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "a ? input1 : input2").WithLocation(9, 18)
IOperation\IOperationTests_ISwitchOperation.cs (10)
1311
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "other").WithLocation(8, 18)
1474
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "1").WithLocation(8, 18)
1818
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "other").WithLocation(8, 18)
1892
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "other").WithLocation(8, 18)
2081
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "other").WithLocation(8, 18)
2256
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "input1 ?? input2").WithLocation(8, 18)
2533
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "other ?? 1").WithLocation(8, 18)
3128
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "1+TakeOutParam(3, out MyClass x1)").WithLocation(8, 18)
3225
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "1+(input is int x1 ? x1 : 0)").WithLocation(8, 18)
3484
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "other").WithLocation(8, 20)
IOperation\IOperationTests_StackAllocArrayCreationAndInitializer.cs (1)
291
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "dimension").WithLocation(6, 42)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (35)
Semantics\ConstantTests.cs (2)
3408
Diagnostic(ErrorCode.
ERR_ConstantExpected
, @"(string)(object)""b""").WithLocation(19, 18),
3417
Diagnostic(ErrorCode.
ERR_ConstantExpected
, @"(object)""b""").WithLocation(23, 18),
Semantics\ImplicitObjectCreationTests.cs (6)
2624
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "new()").WithLocation(8, 18),
2627
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "new()").WithLocation(9, 19)
3722
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "new()").WithLocation(10, 27)
4851
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "new()").WithLocation(6, 18),
4857
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "new()").WithLocation(12, 18),
4860
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "new T()").WithLocation(13, 18)
Semantics\InterpolationTests.cs (3)
654
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "1E10").WithLocation(5, 22),
660
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "(int)1E10").WithLocation(6, 22)
1560
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "a").WithLocation(4, 21)
Semantics\NullableReferenceTypesTests.cs (2)
77488
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "F").WithLocation(6, 18),
115795
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "default(T)").WithLocation(6, 19),
Semantics\NullableReferenceTypesVsPatterns.cs (1)
179
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "nonConstant").WithLocation(7, 18),
Semantics\OutVarTests.cs (3)
32604
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "!TakeOutParam(3, out var x1)").WithLocation(8, 18)
34925
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "!M(nameof(M(out int z1)), z1)").WithLocation(8, 18),
34931
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "!M(nameof(M(out var z2)), z2)").WithLocation(11, 18),
Semantics\PrimaryConstructorTests.cs (4)
8470
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "p1").WithLocation(6, 21),
8473
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "p2.F").WithLocation(6, 32)
8515
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "goto case p1;").WithLocation(11, 17)
10506
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "Color.Red").WithLocation(10, 22)
Semantics\RawInterpolationTests.cs (3)
669
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "1E10").WithLocation(5, 24),
675
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "(int)1E10").WithLocation(6, 24));
1231
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "a").WithLocation(4, 23));
Semantics\SemanticAnalyzerTests.cs (1)
1294
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "x").WithLocation(14, 35),
Semantics\SemanticErrorTests.cs (2)
4265
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "x"));
9015
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "-1L").WithLocation(10, 35));
Semantics\StackAllocInitializerTests.cs (3)
760
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "await Task.FromResult(1)").WithLocation(8, 38),
2534
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "*obj1").WithLocation(7, 41),
2537
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "obj2.Length").WithLocation(8, 46),
Semantics\SwitchTests.cs (4)
153
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "test").WithLocation(11, 18)
158
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "test").WithLocation(11, 18)
1043
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "1+(o.GetType().Name.Length)").WithLocation(8, 19),
1054
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "1+(o.GetType().Name.Length)").WithLocation(8, 19),
Semantics\Utf8StringsLiteralsTests.cs (1)
2949
Diagnostic(ErrorCode.
ERR_ConstantExpected
, @"""2""u8").WithLocation(8, 18)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
Symbols\ConversionTests.cs (2)
1135
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "default(Convertible)").WithLocation(8, 18)
1165
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "c").WithLocation(9, 18)
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (1)
Parsing\ParserErrorMessageTests.cs (1)
244
Diagnostic(ErrorCode.
ERR_ConstantExpected
, "}").WithLocation(4, 42),