98 references to ERR_ImplicitlyTypedArrayNoBestType
Microsoft.CodeAnalysis.CSharp (3)
Binder\Binder_Expressions.cs (2)
3419
Error(diagnostics, ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, node);
3446
Error(diagnostics, ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, node);
Errors\ErrorFacts.cs (1)
1054
case ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
:
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (2)
CodeGen\CodeGenImplicitlyTypeArraysTests.cs (2)
140
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new [] {E.START, 0, 0U, 0u, 0L, 0l, 0UL, 0Ul, 0uL, 0ul, 0LU, 0Lu, 0lU, 0lu}").WithLocation(15, 21),
998
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { E.FortyTwo, 0 }").WithLocation(16, 21));
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (4)
IOperation\IOperationTests_ArrayCreationAndInitializer.cs (2)
423
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[]/*</bind>*/").WithLocation(6, 27)
461
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[2]/*</bind>*/").WithLocation(6, 27)
IOperation\IOperationTests_StackAllocArrayCreationAndInitializer.cs (2)
387
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "stackalloc[]/*</bind>*/").WithLocation(6, 27)
422
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "stackalloc[2]/*</bind>*/").WithLocation(6, 27)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (87)
Semantics\DelegateTypeTests.cs (39)
4521
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { () => 0, () => 1 }").WithLocation(8, 20));
4797
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { M1, (string s) => int.Parse(s) }").WithLocation(8, 18),
4800
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { (string s) => s.Length, M2 }").WithLocation(9, 18));
4830
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { F1<object>, F1<string> }").WithLocation(8, 18),
4833
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { F2<object>, F2<string> }").WithLocation(9, 18));
4861
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { F1<int>, F1<object> }").WithLocation(8, 18),
4864
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { F2<nint>, F2<System.IntPtr> }").WithLocation(9, 18),
4867
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { F3<string>, F3<object> }").WithLocation(10, 18)
4900
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { F<string?>, F<string> }").WithLocation(8, 18),
4903
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { F<(int X, object Y)>, F<(int, dynamic)> }").WithLocation(9, 18));
4931
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { (object o) => { }, (string s) => { } }").WithLocation(6, 18),
4934
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { () => (object)null, () => (string)null }").WithLocation(7, 18));
4969
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { F1<string>, F1<string> }").WithLocation(8, 18),
4972
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { F2<object, string>, F2<object, string> }").WithLocation(9, 18));
5003
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { F1<object>, F1<string> }").WithLocation(8, 18),
5006
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { F2<object, string>, F2<object, object> }").WithLocation(9, 18)
5038
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { F<object>, F<string> }").WithLocation(6, 18),
5041
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { (object x, ref object y) => { }, (string x, ref object y) => { } }").WithLocation(7, 18),
5044
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { (object x, ref object y) => { }, (object x, ref string y) => { } }").WithLocation(8, 18)
5078
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { F<object>, null }").WithLocation(7, 18),
5081
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { default, F<string> }").WithLocation(8, 18),
5084
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { null, default, (object x, ref string y) => { } }").WithLocation(9, 18));
5122
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { F1 }").WithLocation(8, 18),
5125
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { F1, F2 }").WithLocation(9, 18),
5128
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { F2, F1 }").WithLocation(10, 18),
5131
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { x => x }").WithLocation(11, 18),
5134
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { x => x, (int y) => y }").WithLocation(12, 18),
5137
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { (int y) => y, static x => x }").WithLocation(13, 18),
5140
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { x => x, F1 }").WithLocation(14, 18),
5143
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { F1, (int y) => y }").WithLocation(15, 18));
5149
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { F1 }").WithLocation(8, 18),
5152
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { x => x }").WithLocation(11, 18),
5155
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { x => x, F1 }").WithLocation(14, 18));
5234
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { () => 1 }").WithLocation(6, 18));
15084
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { (int i = 1) => { }, (int i = 2) => { } }").WithLocation(1, 11));
16239
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { MethodNoParams, MethodWithParams }").WithLocation(7, 10),
16242
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { inferredNoParams, inferredWithParams }").WithLocation(8, 10),
16245
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { lambdaNoParams, lambdaWithParams }").WithLocation(9, 10),
16248
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { (int[] xs) => xs.Length, (params int[] xs) => xs.Length }").WithLocation(10, 10));
Semantics\ForEachTests.cs (2)
1112
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { Main() }"));
1134
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { Main() }"),
Semantics\FunctionPointerTests.cs (7)
2386
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { ptr1, ptr2 }").WithLocation(10, 20),
2389
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { ptr1, ptr3 }").WithLocation(11, 20),
2392
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { ptr1, ptr4 }").WithLocation(12, 20),
2395
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { ptr5, ptr6 }").WithLocation(18, 20),
2398
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { ptr5, ptr7 }").WithLocation(19, 20),
2401
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { ptr5, ptr8 }").WithLocation(20, 20)
2515
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { i1, i2 }").WithLocation(12, 47)
Semantics\ImplicitObjectCreationTests.cs (1)
3062
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { new(), new() }").WithLocation(6, 17)
Semantics\NativeIntegerTests.cs (4)
14227
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { x, y }").WithLocation(9, 10),
14230
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { y, x }").WithLocation(10, 10),
14279
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { x, y }").WithLocation(8, 13),
14288
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { x, y }").WithLocation(14, 13),
Semantics\NullableReferenceTypesTests.cs (7)
58004
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { x1, y1 }").WithLocation(5, 18),
58007
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { y1, x1 }").WithLocation(7, 18));
58470
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { }").WithLocation(5, 17),
58473
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { null }").WithLocation(6, 17));
156333
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "stackalloc[] { }").WithLocation(7, 18),
156336
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "stackalloc[] { null }").WithLocation(8, 18),
156339
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "stackalloc[] { x => x }").WithLocation(9, 18)
Semantics\ObjectAndCollectionInitializerTests.cs (1)
3205
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { Main() }"));
Semantics\RefFieldTests.cs (2)
17358
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { (R r) => { }, (scoped R r) => { } }").WithLocation(6, 18),
17361
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { (ref R r) => { }, (scoped ref R r) => { } }").WithLocation(8, 18));
Semantics\SemanticErrorTests.cs (11)
12345
new ErrorDescription { Code = (int)ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, Line = 12, Column = 17 },
12346
new ErrorDescription { Code = (int)ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, Line = 20, Column = 22 },
12347
new ErrorDescription { Code = (int)ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, Line = 22, Column = 17 },
12348
new ErrorDescription { Code = (int)ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, Line = 25, Column = 19 },
12349
new ErrorDescription { Code = (int)ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, Line = 27, Column = 18 },
12350
new ErrorDescription { Code = (int)ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, Line = 28, Column = 18 },
12351
new ErrorDescription { Code = (int)ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, Line = 30, Column = 18 },
12352
new ErrorDescription { Code = (int)ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, Line = 31, Column = 18 },
12353
new ErrorDescription { Code = (int)ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, Line = 33, Column = 18 },
12354
new ErrorDescription { Code = (int)ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, Line = 34, Column = 18 },
12355
new ErrorDescription { Code = (int)ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, Line = 36, Column = 17 }});
Semantics\StackAllocInitializerTests.cs (12)
144
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "stackalloc[] { new A(), new B() }").WithLocation(9, 18),
147
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "stackalloc[] { }").WithLocation(10, 18),
150
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "stackalloc[] { VoidMethod() }").WithLocation(11, 18),
153
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "stackalloc[] { null }").WithLocation(12, 18),
156
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "stackalloc[] { (1, null) }").WithLocation(13, 18),
162
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "stackalloc[] { new {} , new { i = 0 } }").WithLocation(15, 18),
206
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "stackalloc[] { new A(), new B() }").WithLocation(9, 32),
209
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "stackalloc[] { }").WithLocation(10, 32),
212
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "stackalloc[] { VoidMethod() }").WithLocation(11, 32),
215
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "stackalloc[] { null }").WithLocation(12, 32),
218
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "stackalloc[] { (1, null) }").WithLocation(13, 32),
224
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "stackalloc[] { new {} , new { i = 0 } }").WithLocation(15, 32),
Semantics\TargetTypedDefaultTests.cs (1)
2254
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new[] { default, default }").WithLocation(6, 17)
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (2)
Parsing\ParserErrorMessageTests.cs (2)
5737
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new [] { }").WithLocation(6, 17));
5747
Diagnostic(ErrorCode.
ERR_ImplicitlyTypedArrayNoBestType
, "new [] { }").WithLocation(6, 17));