256 references to ERR_NoExplicitConv
Microsoft.CodeAnalysis.CSharp (6)
Binder\Binder_Expressions.cs (4)
2815
diagnostics.Add(ErrorCode.
ERR_NoExplicitConv
, syntax.Location, distinguisher1.First, distinguisher1.Second);
2828
diagnostics.Add(ErrorCode.
ERR_NoExplicitConv
, syntax.Location, MessageID.IDS_SK_METHOD.Localize(), targetType);
2890
diagnostics.Add(ErrorCode.
ERR_NoExplicitConv
, syntax.Location, distinguisher.First, distinguisher.Second);
7010
Error(diagnostics, ErrorCode.
ERR_NoExplicitConv
, node, distinguisher.First, distinguisher.Second);
Binder\ForEachLoopBinder.cs (1)
504
diagnostics.Add(ErrorCode.
ERR_NoExplicitConv
, foreachKeyword.GetLocation(), distinguisher.First, distinguisher.Second);
Errors\ErrorFacts.cs (1)
660
or ErrorCode.
ERR_NoExplicitConv
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (13)
CodeGen\CodeGenAwaitForeachTests.cs (2)
931
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "foreach").WithArguments("int", "string").WithLocation(6, 15)
983
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "foreach").WithArguments("int", "Element").WithLocation(7, 15)
CodeGen\CodeGenMscorlib.cs (2)
381
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(object)__makeref(result)").WithArguments("System.TypedReference", "object").WithLocation(11, 15)
440
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(object)__makeref(result)").WithArguments("System.TypedReference", "object").WithLocation(11, 15)
CodeGen\CodeGenTupleTest.cs (9)
7109
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "((int, int))(1, 1, 1)").WithArguments("(int, int, int)", "(int, int)").WithLocation(9, 13),
7112
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"""string""").WithArguments("string", "int").WithLocation(10, 29),
8022
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"""qq""").WithArguments("string", "long").WithLocation(12, 56),
17963
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C1)x").WithArguments("(int, (int, (int, (int, (int, (int, int))))))", "C.C1").WithLocation(8, 16),
17966
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "((int, (int, int)))y").WithArguments("C.C1", "(int, (int, int))").WithLocation(13, 32),
17969
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "((int, (int, (int, (int, (int, (int, (int, (int, (int, (int, (int, int))))))))))))y").WithArguments("C.C1", "(int, (int, (int, (int, (int, (int, (int, (int, (int, (int, (int, int)))))))))))").WithLocation(16, 96)
18176
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"((int, C1)?)
18669
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "((B, B))xt").WithArguments("(int, int)", "(B, B)").WithLocation(31, 14),
18672
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "((B, B)?)xt").WithArguments("(int, int)", "(B, B)?").WithLocation(34, 14)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (3)
Emit\NumericIntPtrTests.cs (3)
3561
expectedErrorCode: expectedExplicitIL is null ? ErrorCode.
ERR_NoExplicitConv
: 0);
3572
expectedErrorCode: expectedCheckedIL is null ? ErrorCode.
ERR_NoExplicitConv
: 0);
10289
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(FinalType)x").WithArguments(AsNative(sourceType), "FinalType")
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (66)
Attributes\AttributeTests_WellKnownAttributes.cs (1)
4555
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "new I()").WithArguments("System.StackOverflowException", "I").WithLocation(14, 17));
FirstClassSpanTests.cs (35)
873
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<object>)source()").WithArguments("System.Span<string>", "System.ReadOnlySpan<object>").WithLocation(2, 26));
955
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<object>)source()").WithArguments("System.ReadOnlySpan<string>", "System.ReadOnlySpan<object>").WithLocation(2, 26));
2921
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(Span<string>)arg").WithArguments("int[]", "System.Span<string>").WithLocation(4, 34));
2982
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<string>)arg").WithArguments("int[]", "System.ReadOnlySpan<string>").WithLocation(4, 42));
3014
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<string>)arg").WithArguments("System.Span<int>", "System.ReadOnlySpan<string>").WithLocation(4, 46));
3095
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<string>)arg").WithArguments("System.ReadOnlySpan<int>", "System.ReadOnlySpan<string>").WithLocation(4, 54));
3256
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, $"(Span<{type}>)arg").WithArguments("System.ReadOnlySpan<string>", $"System.Span<{type}>").WithLocation(4, 49));
3402
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(Span<char>)arg").WithArguments("string", "System.Span<char>").WithLocation(4, 33));
3620
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<string>)arg").WithArguments("System.Span<object?>", "System.ReadOnlySpan<string>").WithLocation(12, 51),
3623
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<object>)arg").WithArguments("System.Span<string?>", "System.ReadOnlySpan<object>").WithLocation(13, 51));
3638
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<string>)arg").WithArguments("System.Span<object?>", "System.ReadOnlySpan<string>").WithLocation(12, 51),
3683
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<string>)arg").WithArguments("System.ReadOnlySpan<object?>", "System.ReadOnlySpan<string>").WithLocation(12, 59),
3686
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<object>)arg").WithArguments("System.ReadOnlySpan<string?>", "System.ReadOnlySpan<object>").WithLocation(13, 59));
3701
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<string>)arg").WithArguments("System.ReadOnlySpan<object?>", "System.ReadOnlySpan<string>").WithLocation(12, 59),
3884
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<S<string>>)arg").WithArguments("S<object?>[]", "System.ReadOnlySpan<S<string>>").WithLocation(12, 53));
3924
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<I<string>>)arg").WithArguments("System.Span<I<object?>>", "System.ReadOnlySpan<I<string>>").WithLocation(12, 57));
3939
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<I<string>>)arg").WithArguments("System.Span<I<object?>>", "System.ReadOnlySpan<I<string>>").WithLocation(12, 57)
3980
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<S<string>>)arg").WithArguments("System.ReadOnlySpan<S<object?>>", "System.ReadOnlySpan<S<string>>").WithLocation(12, 65));
4410
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int[])arg").WithArguments("System.Span<int>", "int[]").WithLocation(3, 40),
4413
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int[])arg").WithArguments("System.ReadOnlySpan<int>", "int[]").WithLocation(4, 48),
4416
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(object[])arg").WithArguments("System.ReadOnlySpan<string>", "object[]").WithLocation(5, 54),
4419
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(string[])arg").WithArguments("System.ReadOnlySpan<object>", "string[]").WithLocation(6, 54));
4435
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(Span<int>)arg").WithArguments("System.ReadOnlySpan<int>", "System.Span<int>").WithLocation(4, 45));
4451
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<string>)arg").WithArguments("System.ReadOnlySpan<object>", "System.ReadOnlySpan<string>").WithLocation(4, 59));
4467
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(string)arg").WithArguments("System.ReadOnlySpan<char>", "string").WithLocation(4, 43));
5721
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, $"({type}<I<object>>)x").WithArguments("I<string>[]", $"System.{type}<I<object>>").WithLocation(6, 12));
5895
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<U>)x").WithArguments("T[]", "System.ReadOnlySpan<U>").WithLocation(5, 34),
5901
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(Span<U>)x").WithArguments("T[]", "System.Span<U>").WithLocation(7, 26));
5980
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<U>)x").WithArguments("System.Span<T>", "System.ReadOnlySpan<U>").WithLocation(7, 38));
6004
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<U>)x").WithArguments("System.ReadOnlySpan<T>", "System.ReadOnlySpan<U>").WithLocation(7, 46));
6209
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, $"({destination}<int>)new C()").WithArguments("C", $"System.{destination}<int>").WithLocation(3, 5));
7095
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int[])arg").WithArguments("System.Span<int>", "int[]").WithLocation(3, 46),
7098
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int[])arg").WithArguments("System.ReadOnlySpan<int>", "int[]").WithLocation(4, 54),
7101
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(object[])arg").WithArguments("System.ReadOnlySpan<string>", "object[]").WithLocation(5, 57),
7104
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(string[])arg").WithArguments("System.ReadOnlySpan<object>", "string[]").WithLocation(6, 57));
RefReadonlyParameterTests.cs (1)
5205
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C)s").WithArguments("short", "C").WithLocation(7, 5));
RefStructInterfacesTests.cs (17)
5897
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(I1)x").WithArguments("S1", "I1").WithLocation(11, 30)
20582
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(object)x").WithArguments("T", "object").WithLocation(11, 16)
20615
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(I1)x").WithArguments("T", "I1").WithLocation(15, 16)
20649
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(U)x").WithArguments("T", "U").WithLocation(16, 16)
20696
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(object)x").WithArguments("T", "object").WithLocation(22, 16),
20699
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(object)x").WithArguments("S", "object").WithLocation(27, 16)
20748
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(I1)x").WithArguments("T", "I1").WithLocation(24, 16),
20751
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(I1)x").WithArguments("S", "I1").WithLocation(29, 16)
20787
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(S)x").WithArguments("I1", "S").WithLocation(19, 16)
20824
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(S)x").WithArguments("T", "S").WithLocation(20, 16)
20940
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(U)x").WithArguments("T", "U").WithLocation(200, 16),
20946
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(U)x").WithArguments("T", "U").WithLocation(400, 16),
20952
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(T)y").WithArguments("U", "T").WithLocation(600, 16),
20958
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(T)y").WithArguments("U", "T").WithLocation(800, 16),
20964
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(U)x").WithArguments("T", "U").WithLocation(1000, 16)
20994
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(T)x").WithArguments("object", "T").WithLocation(11, 16),
20997
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(S)x").WithArguments("object", "S").WithLocation(16, 16)
Semantics\ExtensionOperatorsTests.cs (2)
65
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int)s1").WithArguments("S1", "int").WithLocation(25, 18),
68
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int)s2").WithArguments("S2", "int").WithLocation(28, 18)
Semantics\ExtensionTests.cs (1)
15745
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(System.Action)D.f").WithArguments("string", "System.Action").WithLocation(1, 9),
Semantics\InlineArrayTests.cs (7)
16582
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(System.ReadOnlySpan<int>)M3()").WithArguments("Buffer10<int>?", "System.ReadOnlySpan<int>").WithLocation(9, 27),
16585
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(System.Span<int>)M3()").WithArguments("Buffer10<int>?", "System.Span<int>").WithLocation(18, 27)
16910
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(System.Span<int>)x").WithArguments("Program", "System.Span<int>").WithLocation(11, 13),
16913
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(System.ReadOnlySpan<int>)x").WithArguments("Program", "System.ReadOnlySpan<int>").WithLocation(12, 13)
17238
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(System.Span<long>)b").WithArguments("Buffer10<int>", "System.Span<long>").WithLocation(7, 13),
17241
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(System.ReadOnlySpan<long>)b").WithArguments("Buffer10<int>", "System.ReadOnlySpan<long>").WithLocation(8, 13)
17472
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(System.Span<int>)C.F").WithArguments("Buffer10", "System.Span<int>").WithLocation(9, 47)
Semantics\ParamsCollectionTests.cs (2)
15789
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(Program)l").WithArguments("System.Collections.Generic.List<long>", "Program").WithLocation(8, 13),
15792
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(Program)a").WithArguments("long[]", "Program").WithLocation(9, 13),
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (13)
IOperation\IOperationTests_ArrayCreationAndInitializer.cs (1)
919
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int)M()").WithArguments("C", "int").WithLocation(6, 38)
IOperation\IOperationTests_IConversionExpression.cs (10)
3966
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C2)c1").WithArguments("C1", "C2").WithLocation(7, 27)
4060
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C1)i1").WithArguments("I1", "C1").WithLocation(9, 27)
4190
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C2[])c1arr").WithArguments("C1[]", "C2[]").WithLocation(7, 32)
4222
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C1[][])c1arr").WithArguments("C1[]", "C1[][]").WithLocation(7, 34)
4318
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(IList<C1>)c1arr").WithArguments("C1[][]", "System.Collections.Generic.IList<C1>").WithLocation(10, 38)
4384
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C1[][])c1List").WithArguments("System.Collections.Generic.IList<C1>", "C1[][]").WithLocation(10, 34)
4728
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(S1)i").WithArguments("I1", "S1").WithLocation(9, 27)
4825
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(T)u").WithArguments("U", "T").WithLocation(8, 25)
5044
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(int)""""").WithArguments("string", "int").WithLocation(8, 26)
5175
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(Action<int>)objectAction").WithArguments("System.Action<object>", "System.Action<int>").WithLocation(8, 43)
IOperation\IOperationTests_InvalidExpression.cs (1)
243
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(Program)x.i1").WithArguments("int", "Program").WithLocation(10, 31),
IOperation\IOperationTests_StackAllocArrayCreationAndInitializer.cs (1)
672
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int)M()").WithArguments("C", "int").WithLocation(6, 42)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (132)
Semantics\ArglistTests.cs (1)
582
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(object)new System.ArgIterator()").WithArguments("System.ArgIterator", "object").WithLocation(31, 23),
Semantics\DelegateTypeTests.cs (29)
179
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(object)Main").WithArguments("method", "object").WithLocation(6, 17),
182
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ICloneable)Main").WithArguments("method", "System.ICloneable").WithLocation(7, 17),
185
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(Delegate)Main").WithArguments("method", "System.Delegate").WithLocation(8, 17),
188
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(MulticastDelegate)Main").WithArguments("method", "System.MulticastDelegate").WithLocation(9, 17));
224
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(System.Linq.Expressions.Expression)F").WithArguments("method", "System.Linq.Expressions.Expression").WithLocation(6, 13),
230
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(System.Linq.Expressions.LambdaExpression)F").WithArguments("method", "System.Linq.Expressions.LambdaExpression").WithLocation(8, 13));
764
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, $"(System.Delegate){methodGroupExpression}").WithArguments("method", "System.Delegate").WithLocation(6, 20)
3350
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(object)GetValue").WithArguments("method", "object").WithLocation(8, 13),
3359
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(object)GetValue").WithArguments("method", "object").WithLocation(12, 13));
3399
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(object)F").WithArguments("method", "object").WithLocation(5, 27),
3405
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(object)F").WithArguments("method", "object").WithLocation(7, 33));
3445
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(object)F").WithArguments("method", "object").WithLocation(6, 33),
3571
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(System.Delegate)p.F").WithArguments("method", "System.Delegate").WithLocation(8, 20));
15062
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C1)F").WithArguments("method", "C1").WithLocation(21, 13),
15065
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C2)F").WithArguments("method", "C2").WithLocation(22, 13)
15151
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C1)F").WithArguments("method", "C1").WithLocation(34, 13),
15154
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C2)F").WithArguments("method", "C2").WithLocation(35, 13)
15211
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C<object>)F").WithArguments("method", "C<object>").WithLocation(17, 13),
15214
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C<ICloneable>)F").WithArguments("method", "C<System.ICloneable>").WithLocation(18, 13)
15288
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C<Delegate>)F").WithArguments("method", "C<System.Delegate>").WithLocation(22, 13),
15291
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C<MulticastDelegate>)F").WithArguments("method", "C<System.MulticastDelegate>").WithLocation(23, 13)
15376
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C1)F").WithArguments("method", "C1").WithLocation(17, 13),
15379
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C2)F").WithArguments("method", "C2").WithLocation(18, 13)
15441
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C1)F").WithArguments("method", "C1").WithLocation(28, 13),
15444
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C2)F").WithArguments("method", "C2").WithLocation(29, 13)
15485
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C<object>)F").WithArguments("method", "C<object>").WithLocation(13, 13),
15488
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C<ICloneable>)F").WithArguments("method", "C<System.ICloneable>").WithLocation(14, 13)
15538
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C<Delegate>)F").WithArguments("method", "C<System.Delegate>").WithLocation(16, 13),
15541
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C<MulticastDelegate>)F").WithArguments("method", "C<System.MulticastDelegate>").WithLocation(17, 13)
Semantics\DynamicTests.cs (1)
62
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int*)d").WithArguments("dynamic", "int*"));
Semantics\ForEachTests.cs (5)
161
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "foreach").WithArguments("string", "int"));
907
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "foreach").WithArguments("int", "S").WithLocation(31, 9),
909
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "foreach").WithArguments("int", "string").WithLocation(32, 9));
1141
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "foreach").WithArguments("?", "int"));
1166
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "foreach").WithArguments("int", "void").WithLocation(6, 9)
Semantics\FunctionPointerTests.cs (4)
3138
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(dynamic)ptr").WithArguments("delegate*<void>", "dynamic").WithLocation(7, 13),
3144
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(delegate*<void>)d").WithArguments("dynamic", "delegate*<void>").WithLocation(9, 15)
4176
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(delegate*<int, void>)true").WithArguments("bool", "delegate*<int, void>").WithLocation(8, 10)
4201
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(delegate* managed<object?, long>)false").WithArguments("bool", "delegate*<object?, long>").WithLocation(9, 58)
Semantics\InterpolationTests.cs (1)
4278
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(S)$""""").WithArguments("string", "S").WithLocation(8, 25)
Semantics\MultiDimensionalArrayTests.cs (2)
479
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(double[])t.Test1()").WithArguments("double[*]", "double[]").WithLocation(7, 23),
488
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(System.Collections.Generic.IList<double>)t.Test1()").WithArguments("double[*]", "System.Collections.Generic.IList<double>").WithLocation(11, 18),
Semantics\NativeIntegerTests.cs (3)
7863
expectedExplicitIL is null ? ErrorCode.
ERR_NoExplicitConv
: 0);
7874
expectedCheckedIL is null ? ErrorCode.
ERR_NoExplicitConv
: 0);
15078
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(FinalType)x").WithArguments(sourceType, "FinalType")
Semantics\NullableReferenceTypesTests.cs (3)
129838
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int?)x").WithArguments("U", "int?").WithLocation(11, 14),
129847
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int?)x").WithArguments("U", "int?").WithLocation(20, 14));
130355
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(S?)F").WithArguments("method", "S?").WithLocation(6, 18));
Semantics\SemanticErrorTests.cs (2)
1676
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(iii)0").WithArguments("int", "x.iii"));
1729
CreateCompilation(text).VerifyDiagnostics(Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "foreach").WithArguments("int[]", "int"));
Semantics\UnsafeTests.cs (37)
8560
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(bool)pi").WithArguments("int*", "bool"),
8563
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(char)pi").WithArguments("int*", "char"),
8566
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(double)pi").WithArguments("int*", "double"),
8569
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(decimal)pi").WithArguments("int*", "decimal"),
8572
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(float)pi").WithArguments("int*", "float"),
8575
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(bool)pv").WithArguments("void*", "bool"),
8578
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(char)pv").WithArguments("void*", "char"),
8581
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(double)pv").WithArguments("void*", "double"),
8584
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(decimal)pv").WithArguments("void*", "decimal"),
8587
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(float)pv").WithArguments("void*", "float"),
8590
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int*)b").WithArguments("bool", "int*"),
8593
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int*)c").WithArguments("char", "int*"),
8596
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int*)d").WithArguments("double", "int*"),
8599
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int*)d").WithArguments("double", "int*"),
8602
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int*)f").WithArguments("float", "int*"),
8605
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(void*)b").WithArguments("bool", "void*"),
8608
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(void*)c").WithArguments("char", "void*"),
8611
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(void*)d").WithArguments("double", "void*"),
8614
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(void*)e").WithArguments("decimal", "void*"),
8617
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(void*)f").WithArguments("float", "void*"));
8670
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int*)sb").WithArguments("sbyte?", "int*"),
8673
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int*)b").WithArguments("byte?", "int*"),
8676
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int*)s").WithArguments("short?", "int*"),
8679
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int*)us").WithArguments("ushort?", "int*"),
8682
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int*)i").WithArguments("int?", "int*"),
8685
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int*)ui").WithArguments("uint?", "int*"),
8688
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int*)l").WithArguments("long?", "int*"),
8691
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int*)ul").WithArguments("ulong?", "int*"),
8694
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(void*)sb").WithArguments("sbyte?", "void*"),
8697
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(void*)b").WithArguments("byte?", "void*"),
8700
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(void*)s").WithArguments("short?", "void*"),
8703
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(void*)us").WithArguments("ushort?", "void*"),
8706
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(void*)i").WithArguments("int?", "void*"),
8709
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(void*)ui").WithArguments("uint?", "void*"),
8712
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(void*)l").WithArguments("long?", "void*"),
8715
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(void*)ul").WithArguments("ulong?", "void*"));
12044
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int*)obj").WithArguments("object", "int*"));
Semantics\UserDefinedConversionTests.cs (2)
489
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(X<T>)t").WithArguments("T", "X<T>"));
1647
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C<object>) M1()").WithArguments("void", "C<object>").WithLocation(9, 16));
Semantics\Utf8StringsLiteralsTests.cs (42)
231
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(byte[])""hello""").WithArguments("string", "byte[]").WithLocation(7, 21),
234
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(Span<byte>)""dog""").WithArguments("string", "System.Span<byte>").WithLocation(8, 20),
237
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(ReadOnlySpan<byte>)""cat""").WithArguments("string", "System.ReadOnlySpan<byte>").WithLocation(9, 28)
260
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(byte[])""hello""u8").WithArguments("System.ReadOnlySpan<byte>", "byte[]").WithLocation(7, 21),
263
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(Span<byte>)""dog""u8").WithArguments("System.ReadOnlySpan<byte>", "System.Span<byte>").WithLocation(8, 20)
288
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(byte[])nullConstant").WithArguments("string", "byte[]").WithLocation(8, 21),
291
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(Span<byte>)nullConstant").WithArguments("string", "System.Span<byte>").WithLocation(9, 20),
294
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<byte>)nullConstant").WithArguments("string", "System.ReadOnlySpan<byte>").WithLocation(10, 28)
343
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"""hello""").WithArguments("string", "byte[]").WithLocation(6, 54),
346
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"""dog""").WithArguments("string", "byte[]").WithLocation(6, 64)
522
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(byte[])value").WithArguments("string", "byte[]").WithLocation(9, 21),
525
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(Span<byte>)value").WithArguments("string", "System.Span<byte>").WithLocation(10, 20),
528
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<byte>)value").WithArguments("string", "System.ReadOnlySpan<byte>").WithLocation(11, 28)
986
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(C1)""hello""").WithArguments("string", "C1").WithLocation(8, 17),
989
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(C2)""dog""").WithArguments("string", "C2").WithLocation(9, 17),
992
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(C3)""cat""").WithArguments("string", "C3").WithLocation(10, 17)
1042
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"""hello""").WithArguments("string", "C1").WithLocation(8, 30),
1045
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"""dog""").WithArguments("string", "C2").WithLocation(8, 40),
1048
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"""cat""").WithArguments("string", "C3").WithLocation(8, 47)
1100
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(C1)""hello""").WithArguments("string", "C1").WithLocation(8, 17),
1103
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(C2)""dog""").WithArguments("string", "C2").WithLocation(9, 17),
1106
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(C3)""cat""").WithArguments("string", "C3").WithLocation(10, 17)
1156
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"""hello""").WithArguments("string", "C1").WithLocation(8, 30),
1159
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"""dog""").WithArguments("string", "C2").WithLocation(8, 40),
1162
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"""cat""").WithArguments("string", "C3").WithLocation(8, 47)
1371
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(C1)""hello""").WithArguments("string", "C1").WithLocation(8, 40),
1374
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(C2)""dog""").WithArguments("string", "C2").WithLocation(9, 40),
1377
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(C3)""cat""").WithArguments("string", "C3").WithLocation(10, 40)
2280
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(C2)""dog""u8").WithArguments("System.ReadOnlySpan<byte>", "C2").WithLocation(7, 17),
2283
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(C3)""cat""u8").WithArguments("System.ReadOnlySpan<byte>", "C3").WithLocation(8, 17)
2403
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(C2)""dog""u8").WithArguments("System.ReadOnlySpan<byte>", "C2").WithLocation(7, 17),
2406
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(C3)""cat""u8").WithArguments("System.ReadOnlySpan<byte>", "C3").WithLocation(8, 17)
2611
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(byte[])""05""u8").WithArguments("System.ReadOnlySpan<byte>", "byte[]").WithLocation(11, 32),
2614
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(Span<byte>)""06""u8").WithArguments("System.ReadOnlySpan<byte>", "System.Span<byte>").WithLocation(12, 36),
2695
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(byte[])""3""U8").WithArguments("System.ReadOnlySpan<byte>", "byte[]").WithLocation(22, 11)
2743
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(Span<byte>)""3""U8").WithArguments("System.ReadOnlySpan<byte>", "System.Span<byte>").WithLocation(22, 11)
2824
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(byte[])s").WithArguments("string", "byte[]").WithLocation(10, 13),
2827
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(Span<byte>)s").WithArguments("string", "System.Span<byte>").WithLocation(11, 13),
2830
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(ReadOnlySpan<byte>)s").WithArguments("string", "System.ReadOnlySpan<byte>").WithLocation(12, 13)
2866
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(byte[])$""4{s}""").WithArguments("string", "byte[]").WithLocation(10, 13),
2869
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(Span<byte>)$""5{s}""").WithArguments("string", "System.Span<byte>").WithLocation(11, 13),
2872
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, @"(ReadOnlySpan<byte>)$""6{s}""").WithArguments("string", "System.ReadOnlySpan<byte>").WithLocation(12, 13)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (23)
Symbols\CheckedUserDefinedOperatorsTests.cs (2)
5655
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(long)x").WithArguments("C0", "long").WithLocation(20, 28),
5664
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int)x").WithArguments("C0", "int").WithLocation(35, 28)
Symbols\DefaultInterfaceImplementationTests.cs (2)
47182
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int)x").WithArguments("I1", "int").WithLocation(16, 13),
47185
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(byte)x").WithArguments("I1", "byte").WithLocation(17, 17),
Symbols\GenericConstraintConversionTests.cs (9)
693
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(T)b1t").WithArguments("B1<T>", "T").WithLocation(14, 13),
695
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(T)b2").WithArguments("B2", "T").WithLocation(16, 13),
697
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(U)b1o").WithArguments("B1<object>", "U").WithLocation(21, 13),
699
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(U)b2").WithArguments("B2", "U").WithLocation(22, 13));
793
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(V)w").WithArguments("W", "V"),
822
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(U)t").WithArguments("int", "U").WithLocation(10, 13),
826
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int)u").WithArguments("U", "int").WithLocation(12, 13));
1007
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(C0)t").WithArguments("T", "C0").WithLocation(17, 48),
1009
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(T)c").WithArguments("C4<T>", "T").WithLocation(21, 38));
Symbols\GenericConstraintTests.cs (6)
5091
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(int[])x").WithArguments("object[]", "int[]").WithLocation(5, 16),
5093
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(U[])x").WithArguments("T[]", "U[]").WithLocation(13, 16),
5095
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(U[])x").WithArguments("T[]", "U[]").WithLocation(17, 16),
5097
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(object[])x").WithArguments("int[]", "object[]").WithLocation(24, 16),
5099
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(T[])x").WithArguments("U[]", "T[]").WithLocation(32, 16),
5101
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(T[])x").WithArguments("U[]", "T[]").WithLocation(36, 16));
Symbols\StaticAbstractMembersInInterfacesTests.cs (3)
30528
var error = (op == "explicit" ? ErrorCode.
ERR_NoExplicitConv
: ErrorCode.ERR_NoImplicitConv);
31529
var error = (op == "explicit" ? ErrorCode.
ERR_NoExplicitConv
: ErrorCode.ERR_NoImplicitConv);
31580
var error = (op == "explicit" ? ErrorCode.
ERR_NoExplicitConv
: ErrorCode.ERR_NoImplicitConv);
Symbols\SymbolDistinguisherTests.cs (1)
425
Diagnostic(ErrorCode.
ERR_NoExplicitConv
, "(S)Lib.M()").WithArguments("S [Metadata, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]", "S [file.cs(2)]").WithLocation(8, 17));