165 references to ERR_UnexpectedVariance
Microsoft.CodeAnalysis.CSharp (2)
Errors\ErrorFacts.cs (1)
1455
or ErrorCode.
ERR_UnexpectedVariance
Symbols\VarianceSafety.cs (1)
482
diagnostics.Add(ErrorCode.
ERR_UnexpectedVariance
, location, context, unsafeTypeParameter, actualVariance.Localize(), expectedVariance.Localize());
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (28)
CodeGen\CodeGenAwaitForeachTests.cs (1)
663
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T").WithArguments("System.Collections.Generic.IAsyncEnumerator<T>.Current", "T", "covariant", "contravariantly").WithLocation(24, 9)
CodeGen\CodeGenRefReturnTests.cs (24)
3185
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref T").WithArguments("RefFunc3<T>.Invoke()", "T", "covariant", "invariantly").WithLocation(6, 10),
3188
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref T").WithArguments("RefFunc2<T>.Invoke()", "T", "contravariant", "invariantly").WithLocation(5, 10),
3191
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref Func<T>").WithArguments("RefFunc3f<T>.Invoke()", "T", "covariant", "invariantly").WithLocation(14, 10),
3194
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref Func<T>").WithArguments("RefFunc2f<T>.Invoke()", "T", "contravariant", "invariantly").WithLocation(13, 10),
3197
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref Action<T>").WithArguments("RefFunc3a<T>.Invoke()", "T", "covariant", "invariantly").WithLocation(10, 10),
3200
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref Action<T>").WithArguments("RefFunc2a<T>.Invoke()", "T", "contravariant", "invariantly").WithLocation(9, 10)
3228
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref T").WithArguments("IM3<T>.RefMethod()", "T", "covariant", "invariantly").WithLocation(6, 24),
3231
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref Action<T>").WithArguments("IM3a<T>.RefMethod()", "T", "covariant", "invariantly").WithLocation(10, 25),
3234
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref Action<T>").WithArguments("IM2a<T>.RefMethod()", "T", "contravariant", "invariantly").WithLocation(9, 24),
3237
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref Func<T>").WithArguments("IM2f<T>.RefMethod()", "T", "contravariant", "invariantly").WithLocation(13, 24),
3240
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref Func<T>").WithArguments("IM3f<T>.RefMethod()", "T", "covariant", "invariantly").WithLocation(14, 25),
3243
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref T").WithArguments("IM2<T>.RefMethod()", "T", "contravariant", "invariantly").WithLocation(5, 23)
3271
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref T").WithArguments("IP2<T>.RefProp", "T", "contravariant", "invariantly").WithLocation(5, 23),
3274
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref Func<T>").WithArguments("IP2f<T>.RefProp", "T", "contravariant", "invariantly").WithLocation(13, 24),
3277
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref Action<T>").WithArguments("IP2a<T>.RefProp", "T", "contravariant", "invariantly").WithLocation(9, 24),
3280
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref Action<T>").WithArguments("IP3a<T>.RefProp", "T", "covariant", "invariantly").WithLocation(10, 25),
3283
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref Func<T>").WithArguments("IP3f<T>.RefProp", "T", "covariant", "invariantly").WithLocation(14, 25),
3286
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref T").WithArguments("IP3<T>.RefProp", "T", "covariant", "invariantly").WithLocation(6, 24)
3314
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref T").WithArguments("IP3<T>.this[int]", "T", "covariant", "invariantly").WithLocation(6, 24),
3317
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref T").WithArguments("IP2<T>.this[int]", "T", "contravariant", "invariantly").WithLocation(5, 23),
3320
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref Action<T>").WithArguments("IP2a<T>.this[int]", "T", "contravariant", "invariantly").WithLocation(9, 24),
3323
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref Action<T>").WithArguments("IP3a<T>.this[int]", "T", "covariant", "invariantly").WithLocation(10, 25),
3326
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref Func<T>").WithArguments("IP2f<T>.this[int]", "T", "contravariant", "invariantly").WithLocation(13, 24),
3329
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref Func<T>").WithArguments("IP3f<T>.this[int]", "T", "covariant", "invariantly").WithLocation(14, 25)
CodeGen\CodeGenTupleTest.cs (3)
22717
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "System.ValueTuple<bool, T>").WithArguments("I<T>.M()", "T", "covariant", "invariantly").WithLocation(4, 5)
22734
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "(bool, T)[]").WithArguments("I<T>.M()", "T", "covariant", "invariantly").WithLocation(4, 5)
22751
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "(bool, T)[]").WithArguments("I<T>.M((bool, T)[])", "T", "contravariant", "invariantly").WithLocation(4, 12)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (114)
Semantics\SemanticErrorTests.cs (86)
17868
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TIn").WithArguments("IContexts<TIn, TOut, TInv>.Property2In", "TIn", "contravariant", "covariantly").WithLocation(6, 5),
17871
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TIn").WithArguments("IContexts<TIn, TOut, TInv>.Property3In", "TIn", "contravariant", "invariantly").WithLocation(7, 5),
17874
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TIn").WithArguments("IContexts<TIn, TOut, TInv>.this[int, char[], char]", "TIn", "contravariant", "covariantly").WithLocation(10, 5),
17877
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TIn").WithArguments("IContexts<TIn, TOut, TInv>.this[int, long[], char]", "TIn", "contravariant", "invariantly").WithLocation(14, 5),
17880
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TIn").WithArguments("IContexts<TIn, TOut, TInv>.Method2In()", "TIn", "contravariant", "covariantly").WithLocation(17, 5),
17883
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TIn").WithArguments("IContexts<TIn, TOut, TInv>.Method3In(out TIn)", "TIn", "contravariant", "invariantly").WithLocation(18, 23),
17886
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TIn").WithArguments("IContexts<TIn, TOut, TInv>.Method4In(ref TIn)", "TIn", "contravariant", "invariantly").WithLocation(19, 23),
17889
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut").WithArguments("IContexts<TIn, TOut, TInv>.Property1Out", "TOut", "covariant", "contravariantly").WithLocation(25, 5),
17892
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut").WithArguments("IContexts<TIn, TOut, TInv>.Property3Out", "TOut", "covariant", "invariantly").WithLocation(27, 5),
17895
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut").WithArguments("IContexts<TIn, TOut, TInv>.this[TOut, char, bool]", "TOut", "covariant", "contravariantly").WithLocation(29, 14),
17898
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut").WithArguments("IContexts<TIn, TOut, TInv>.this[TOut, bool, bool]", "TOut", "covariant", "contravariantly").WithLocation(31, 14),
17901
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut").WithArguments("IContexts<TIn, TOut, TInv>.this[int, bool[], bool]", "TOut", "covariant", "contravariantly").WithLocation(32, 5),
17904
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut").WithArguments("IContexts<TIn, TOut, TInv>.this[TOut, long, bool]", "TOut", "covariant", "contravariantly").WithLocation(33, 14),
17907
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut").WithArguments("IContexts<TIn, TOut, TInv>.this[int, long[], bool]", "TOut", "covariant", "invariantly").WithLocation(34, 5),
17910
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut").WithArguments("IContexts<TIn, TOut, TInv>.Method1Out(TOut)", "TOut", "covariant", "contravariantly").WithLocation(36, 21),
17913
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut").WithArguments("IContexts<TIn, TOut, TInv>.Method3Out(out TOut)", "TOut", "covariant", "invariantly").WithLocation(38, 25),
17916
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut").WithArguments("IContexts<TIn, TOut, TInv>.Method4Out(ref TOut)", "TOut", "covariant", "invariantly").WithLocation(39, 25),
17919
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "Event1Out").WithArguments("IContexts<TIn, TOut, TInv>.Event1Out", "TOut", "covariant", "contravariantly").WithLocation(41, 22));
18000
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TIn").WithArguments("IOutputUnsafe<TIn, TOut, TInv>.Property1Bad", "TIn", "contravariant", "covariantly").WithLocation(9, 5),
18003
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TIn").WithArguments("IOutputUnsafe<TIn, TOut, TInv>.this[char[]]", "TIn", "contravariant", "covariantly").WithLocation(10, 5),
18006
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TIn").WithArguments("IOutputUnsafe<TIn, TOut, TInv>.Method1Bad()", "TIn", "contravariant", "covariantly").WithLocation(11, 5),
18009
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TIn[]").WithArguments("IOutputUnsafe<TIn, TOut, TInv>.Property2Bad", "TIn", "contravariant", "covariantly").WithLocation(19, 5),
18012
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TIn[]").WithArguments("IOutputUnsafe<TIn, TOut, TInv>.this[char[*,*]]", "TIn", "contravariant", "covariantly").WithLocation(20, 5),
18015
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TIn[]").WithArguments("IOutputUnsafe<TIn, TOut, TInv>.Method2Bad()", "TIn", "contravariant", "covariantly").WithLocation(21, 5),
18018
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IOut<TIn>").WithArguments("IOutputUnsafe<TIn, TOut, TInv>.Property3Bad", "TIn", "contravariant", "covariantly").WithLocation(29, 5),
18021
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IOut<TIn>").WithArguments("IOutputUnsafe<TIn, TOut, TInv>.this[char[*,*,*]]", "TIn", "contravariant", "covariantly").WithLocation(30, 5),
18024
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IOut<TIn>").WithArguments("IOutputUnsafe<TIn, TOut, TInv>.Method3Bad()", "TIn", "contravariant", "covariantly").WithLocation(31, 5),
18027
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IInv<TIn>").WithArguments("IOutputUnsafe<TIn, TOut, TInv>.Property4Bad", "TIn", "contravariant", "invariantly").WithLocation(39, 5),
18030
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IInv<TIn>").WithArguments("IOutputUnsafe<TIn, TOut, TInv>.this[char[*,*,*,*]]", "TIn", "contravariant", "invariantly").WithLocation(40, 5),
18033
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IInv<TIn>").WithArguments("IOutputUnsafe<TIn, TOut, TInv>.Method4Bad()", "TIn", "contravariant", "invariantly").WithLocation(41, 5),
18036
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IIn<TOut>").WithArguments("IOutputUnsafe<TIn, TOut, TInv>.Property5Bad", "TOut", "covariant", "contravariantly").WithLocation(49, 5),
18039
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IIn<TOut>").WithArguments("IOutputUnsafe<TIn, TOut, TInv>.this[char[*,*,*,*,*]]", "TOut", "covariant", "contravariantly").WithLocation(50, 5),
18042
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IIn<TOut>").WithArguments("IOutputUnsafe<TIn, TOut, TInv>.Method5Bad()", "TOut", "covariant", "contravariantly").WithLocation(51, 5),
18045
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IInv<TOut>").WithArguments("IOutputUnsafe<TIn, TOut, TInv>.Property6Bad", "TOut", "covariant", "invariantly").WithLocation(59, 5),
18048
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IInv<TOut>").WithArguments("IOutputUnsafe<TIn, TOut, TInv>.this[char[*,*,*,*,*,*]]", "TOut", "covariant", "invariantly").WithLocation(60, 5),
18051
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IInv<TOut>").WithArguments("IOutputUnsafe<TIn, TOut, TInv>.Method6Bad()", "TOut", "covariant", "invariantly").WithLocation(61, 5));
18157
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut").WithArguments("IInputUnsafe<TIn, TOut, TInv>.this[char[]]", "TOut", "covariant", "contravariantly").WithLocation(11, 5),
18160
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut").WithArguments("IInputUnsafe<TIn, TOut, TInv>.this[char[], TOut]", "TOut", "covariant", "contravariantly").WithLocation(12, 36),
18163
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut[]").WithArguments("IInputUnsafe<TIn, TOut, TInv>.this[char[*,*]]", "TOut", "covariant", "contravariantly").WithLocation(23, 5),
18166
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut[]").WithArguments("IInputUnsafe<TIn, TOut, TInv>.this[char[*,*], TOut[]]", "TOut", "covariant", "contravariantly").WithLocation(24, 37),
18169
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IOut<TOut>").WithArguments("IInputUnsafe<TIn, TOut, TInv>.this[char[*,*,*]]", "TOut", "covariant", "contravariantly").WithLocation(36, 5),
18172
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IOut<TOut>").WithArguments("IInputUnsafe<TIn, TOut, TInv>.this[char[*,*,*], IOut<TOut>]", "TOut", "covariant", "contravariantly").WithLocation(37, 38),
18175
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IInv<TOut>").WithArguments("IInputUnsafe<TIn, TOut, TInv>.this[char[*,*,*,*]]", "TOut", "covariant", "invariantly").WithLocation(50, 5),
18178
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IInv<TOut>").WithArguments("IInputUnsafe<TIn, TOut, TInv>.this[char[*,*,*,*], IInv<TOut>]", "TOut", "covariant", "invariantly").WithLocation(51, 39),
18181
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IIn<TIn>").WithArguments("IInputUnsafe<TIn, TOut, TInv>.this[char[*,*,*,*,*]]", "TIn", "contravariant", "covariantly").WithLocation(64, 5),
18184
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IIn<TIn>").WithArguments("IInputUnsafe<TIn, TOut, TInv>.this[char[*,*,*,*,*], IIn<TIn>]", "TIn", "contravariant", "covariantly").WithLocation(65, 40),
18187
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IInv<TIn>").WithArguments("IInputUnsafe<TIn, TOut, TInv>.this[char[*,*,*,*,*,*]]", "TIn", "contravariant", "invariantly").WithLocation(78, 5),
18190
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IInv<TIn>").WithArguments("IInputUnsafe<TIn, TOut, TInv>.this[char[*,*,*,*,*,*], IInv<TIn>]", "TIn", "contravariant", "invariantly").WithLocation(79, 41),
18193
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut").WithArguments("IInputUnsafe<TIn, TOut, TInv>.Property1Bad", "TOut", "covariant", "contravariantly").WithLocation(10, 5),
18196
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut").WithArguments("IInputUnsafe<TIn, TOut, TInv>.Method1Bad(TOut)", "TOut", "covariant", "contravariantly").WithLocation(13, 21),
18199
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut[]").WithArguments("IInputUnsafe<TIn, TOut, TInv>.Property2Bad", "TOut", "covariant", "contravariantly").WithLocation(22, 5),
18202
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut[]").WithArguments("IInputUnsafe<TIn, TOut, TInv>.Method2Bad(TOut[])", "TOut", "covariant", "contravariantly").WithLocation(25, 21),
18205
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IOut<TOut>").WithArguments("IInputUnsafe<TIn, TOut, TInv>.Property3Bad", "TOut", "covariant", "contravariantly").WithLocation(35, 5),
18208
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IOut<TOut>").WithArguments("IInputUnsafe<TIn, TOut, TInv>.Method3Bad(IOut<TOut>)", "TOut", "covariant", "contravariantly").WithLocation(38, 21),
18211
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "Event3Bad").WithArguments("IInputUnsafe<TIn, TOut, TInv>.Event3Bad", "TOut", "covariant", "contravariantly").WithLocation(39, 22),
18214
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IInv<TOut>").WithArguments("IInputUnsafe<TIn, TOut, TInv>.Property4Bad", "TOut", "covariant", "invariantly").WithLocation(49, 5),
18217
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IInv<TOut>").WithArguments("IInputUnsafe<TIn, TOut, TInv>.Method4Bad(IInv<TOut>)", "TOut", "covariant", "invariantly").WithLocation(52, 21),
18220
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "Event4Bad").WithArguments("IInputUnsafe<TIn, TOut, TInv>.Event4Bad", "TOut", "covariant", "invariantly").WithLocation(53, 22),
18223
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IIn<TIn>").WithArguments("IInputUnsafe<TIn, TOut, TInv>.Property5Bad", "TIn", "contravariant", "covariantly").WithLocation(63, 5),
18226
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IIn<TIn>").WithArguments("IInputUnsafe<TIn, TOut, TInv>.Method5Bad(IIn<TIn>)", "TIn", "contravariant", "covariantly").WithLocation(66, 21),
18229
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "Event5Bad").WithArguments("IInputUnsafe<TIn, TOut, TInv>.Event5Bad", "TIn", "contravariant", "covariantly").WithLocation(67, 20),
18232
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IInv<TIn>").WithArguments("IInputUnsafe<TIn, TOut, TInv>.Property6Bad", "TIn", "contravariant", "invariantly").WithLocation(77, 5),
18235
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IInv<TIn>").WithArguments("IInputUnsafe<TIn, TOut, TInv>.Method6Bad(IInv<TIn>)", "TIn", "contravariant", "invariantly").WithLocation(80, 21),
18238
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "Event6Bad").WithArguments("IInputUnsafe<TIn, TOut, TInv>.Event6Bad", "TIn", "contravariant", "invariantly").WithLocation(81, 21));
18256
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut").WithArguments("IIn<TOut>", "TOut", "covariant", "contravariantly"),
18258
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TIn").WithArguments("IOut<TIn>", "TIn", "contravariant", "covariantly"));
18325
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ICovariant<TOutputUnsafe>").WithArguments("IOutputUnsafeTable<TInputUnsafe, TOutputUnsafe, TInvariant>.OutputUnsafe2()", "TOutputUnsafe", "contravariant", "covariantly").WithLocation(5, 5),
18328
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IContravariant<TInputUnsafe>").WithArguments("IOutputUnsafeTable<TInputUnsafe, TOutputUnsafe, TInvariant>.OutputUnsafe4()", "TInputUnsafe", "covariant", "contravariantly").WithLocation(8, 5),
18331
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IInvariant<TInputUnsafe>").WithArguments("IOutputUnsafeTable<TInputUnsafe, TOutputUnsafe, TInvariant>.OutputUnsafe7()", "TInputUnsafe", "covariant", "invariantly").WithLocation(12, 5),
18334
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IInvariant<TOutputUnsafe>").WithArguments("IOutputUnsafeTable<TInputUnsafe, TOutputUnsafe, TInvariant>.OutputUnsafe8()", "TOutputUnsafe", "contravariant", "invariantly").WithLocation(13, 5),
18337
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ICovariant<TInputUnsafe>").WithArguments("IInputUnsafeTable<TInputUnsafe, TOutputUnsafe, TInvariant>.InputUnsafe1(ICovariant<TInputUnsafe>)", "TInputUnsafe", "covariant", "contravariantly").WithLocation(19, 23),
18340
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IContravariant<TOutputUnsafe>").WithArguments("IInputUnsafeTable<TInputUnsafe, TOutputUnsafe, TInvariant>.InputUnsafe5(IContravariant<TOutputUnsafe>)", "TOutputUnsafe", "contravariant", "covariantly").WithLocation(24, 23),
18343
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IInvariant<TInputUnsafe>").WithArguments("IInputUnsafeTable<TInputUnsafe, TOutputUnsafe, TInvariant>.InputUnsafe7(IInvariant<TInputUnsafe>)", "TInputUnsafe", "covariant", "invariantly").WithLocation(27, 23),
18346
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IInvariant<TOutputUnsafe>").WithArguments("IInputUnsafeTable<TInputUnsafe, TOutputUnsafe, TInvariant>.InputUnsafe8(IInvariant<TOutputUnsafe>)", "TOutputUnsafe", "contravariant", "invariantly").WithLocation(28, 23),
18352
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ICovariant<TInputUnsafe>").WithArguments("IBothUnsafeTable<TInputUnsafe, TOutputUnsafe, TInvariant>.InputUnsafe1(ref ICovariant<TInputUnsafe>)", "TInputUnsafe", "covariant", "invariantly").WithLocation(34, 27),
18355
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ICovariant<TOutputUnsafe>").WithArguments("IBothUnsafeTable<TInputUnsafe, TOutputUnsafe, TInvariant>.InputUnsafe2(ref ICovariant<TOutputUnsafe>)", "TOutputUnsafe", "contravariant", "invariantly").WithLocation(35, 27),
18358
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IContravariant<TInputUnsafe>").WithArguments("IBothUnsafeTable<TInputUnsafe, TOutputUnsafe, TInvariant>.InputUnsafe4(ref IContravariant<TInputUnsafe>)", "TInputUnsafe", "covariant", "invariantly").WithLocation(38, 27),
18361
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IContravariant<TOutputUnsafe>").WithArguments("IBothUnsafeTable<TInputUnsafe, TOutputUnsafe, TInvariant>.InputUnsafe5(ref IContravariant<TOutputUnsafe>)", "TOutputUnsafe", "contravariant", "invariantly").WithLocation(39, 27),
18364
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IInvariant<TInputUnsafe>").WithArguments("IBothUnsafeTable<TInputUnsafe, TOutputUnsafe, TInvariant>.InputUnsafe7(ref IInvariant<TInputUnsafe>)", "TInputUnsafe", "covariant", "invariantly").WithLocation(42, 27),
18367
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IInvariant<TOutputUnsafe>").WithArguments("IBothUnsafeTable<TInputUnsafe, TOutputUnsafe, TInvariant>.InputUnsafe8(ref IInvariant<TOutputUnsafe>)", "TOutputUnsafe", "contravariant", "invariantly").WithLocation(43, 27));
18393
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TIn").WithArguments("D1<TIn>.Invoke()", "TIn", "contravariant", "covariantly"),
18395
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut").WithArguments("D5<TOut>.Invoke(TOut)", "TOut", "covariant", "contravariantly"),
18397
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TIn").WithArguments("D7<TIn>.Invoke(ref TIn)", "TIn", "contravariant", "invariantly"),
18399
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut").WithArguments("D8<TOut>.Invoke(ref TOut)", "TOut", "covariant", "invariantly"),
18401
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TIn").WithArguments("D10<TIn>.Invoke(out TIn)", "TIn", "contravariant", "invariantly"),
18403
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "TOut").WithArguments("D11<TOut>.Invoke(out TOut)", "TOut", "covariant", "invariantly"));
Semantics\VarianceTests.cs (28)
447
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "X").WithArguments("I1<T, U, V>.M<X>()", "T", "covariant", "contravariantly").WithLocation(6, 12),
450
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "X").WithArguments("I2<T, U, V>.M<X>()", "T", "covariant", "contravariantly").WithLocation(10, 12),
453
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "X").WithArguments("I3<T, U, V>.M<X>()", "U", "contravariant", "covariantly").WithLocation(14, 12),
456
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "X").WithArguments("I4<T, U, V>.M1<X>()", "T", "covariant", "invariantly").WithLocation(18, 13),
459
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "X").WithArguments("I4<T, U, V>.M2<X>()", "U", "contravariant", "invariantly").WithLocation(19, 13));
503
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "C<T>").WithArguments("I1<T, U>.M(C<U>)", "T", "covariant", "invariantly").WithLocation(5, 5),
506
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "C<T>").WithArguments("I2<T, U>.M(C<T>)", "T", "covariant", "invariantly").WithLocation(9, 12),
509
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "S<T>").WithArguments("I3<T, U>.M(S<U>)", "T", "covariant", "invariantly").WithLocation(13, 5),
512
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "S<T>").WithArguments("I4<T, U>.M(S<T>)", "T", "covariant", "invariantly").WithLocation(17, 12),
515
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "C<T>").WithArguments("I5<T, U>.M(C<U>)", "T", "contravariant", "invariantly").WithLocation(21, 5),
518
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "C<T>").WithArguments("I6<T, U>.M(C<T>)", "T", "contravariant", "invariantly").WithLocation(25, 12),
521
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "S<T>").WithArguments("I7<T, U>.M(S<U>)", "T", "contravariant", "invariantly").WithLocation(29, 5),
524
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "S<T>").WithArguments("I8<T, U>.M(S<T>)", "T", "contravariant", "invariantly").WithLocation(33, 12));
555
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "C<T>.E").WithArguments("I1<T, U>.M(C<U>.E)", "T", "covariant", "invariantly").WithLocation(7, 5),
558
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "C<T>.E").WithArguments("I2<T, U>.M(C<T>.E)", "T", "covariant", "invariantly").WithLocation(11, 14),
561
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "C<T>.E").WithArguments("I3<T, U>.M(C<U>.E)", "T", "contravariant", "invariantly").WithLocation(15, 5),
564
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "C<T>.E").WithArguments("I4<T, U>.M(C<T>.E)", "T", "contravariant", "invariantly").WithLocation(19, 14));
579
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T").WithArguments("IA<IB<T>>", "T", "contravariant", "covariantly").WithLocation(3, 17));
611
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "C<U>").WithArguments("I<T, U>.M(C<T>)", "U", "contravariant", "invariantly").WithLocation(7, 5),
614
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "C<T>").WithArguments("I<T, U>.M(C<T>)", "T", "covariant", "invariantly").WithLocation(7, 12),
617
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "IIn<T>[]").WithArguments("I<T, U>.P", "T", "covariant", "contravariantly").WithLocation(8, 5),
620
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "U").WithArguments("I<T, U>.this[object]", "U", "contravariant", "covariantly").WithLocation(9, 5),
623
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "E").WithArguments("I<T, U>.E", "U", "contravariant", "covariantly").WithLocation(10, 16),
626
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "X").WithArguments("I<T, U>.M<X>()", "U", "contravariant", "invariantly").WithLocation(11, 12),
629
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "X").WithArguments("I<T, U>.M<X>()", "T", "covariant", "contravariantly").WithLocation(11, 12),
632
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T").WithArguments("I<T, T>", "T", "covariant", "contravariantly").WithLocation(14, 17));
645
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T").WithArguments("ITest<T>.M(in T)", "T", "contravariant", "invariantly").WithLocation(4, 15));
658
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "ref readonly T").WithArguments("ITest<T>.M()", "T", "contravariant", "invariantly").WithLocation(4, 5));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (21)
Symbols\DefaultInterfaceImplementationTests.cs (12)
66344
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T1").WithArguments("I1<T1, T2, T3>.D11.Invoke(T1)", "T1", "covariant", "contravariantly").WithLocation(4, 23),
66347
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T2").WithArguments("I1<T1, T2, T3>.D12.Invoke()", "T2", "contravariant", "covariantly").WithLocation(5, 14),
66350
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T1").WithArguments("I1<T1, T2, T3>.M1(T1)", "T1", "covariant", "contravariantly").WithLocation(8, 13),
66353
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T2").WithArguments("I1<T1, T2, T3>.M2()", "T2", "contravariant", "covariantly").WithLocation(9, 5),
66356
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T1").WithArguments("I1<T1, T2, T3>.I2.M21(T1)", "T1", "covariant", "contravariantly").WithLocation(14, 18),
66359
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T2").WithArguments("I1<T1, T2, T3>.I2.M22()", "T2", "contravariant", "covariantly").WithLocation(15, 9)
66423
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T1").WithArguments("I1<T1, T2, T3>.I2.D11.Invoke(T1)", "T1", "covariant", "contravariantly").WithLocation(6, 27),
66426
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T2").WithArguments("I1<T1, T2, T3>.I2.D12.Invoke()", "T2", "contravariant", "covariantly").WithLocation(7, 18),
66429
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T1").WithArguments("I1<T1, T2, T3>.I2.I3.M31(T1)", "T1", "covariant", "contravariantly").WithLocation(12, 22),
66432
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T2").WithArguments("I1<T1, T2, T3>.I2.I3.M32()", "T2", "contravariant", "covariantly").WithLocation(13, 13)
66967
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T1").WithArguments("I1<T1, T2>.M1(T1)", "T1", "covariant", "contravariantly").WithLocation(4, 21),
66970
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T2").WithArguments("I1<T1, T2>.M2()", "T2", "contravariant", "covariantly").WithLocation(5, 13)
Symbols\StaticAbstractMembersInInterfacesTests.cs (8)
7056
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T2").WithArguments("I2<T1, T2>.P2", "T2", "contravariant", "covariantly").WithLocation(5, 21),
7059
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T1").WithArguments("I2<T1, T2>.P3", "T1", "covariant", "contravariantly").WithLocation(6, 21)
7086
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T2").WithArguments("I2<T1, T2>.M2()", "T2", "contravariant", "covariantly").WithLocation(5, 21),
7089
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T1").WithArguments("I2<T1, T2>.M3(T1)", "T1", "covariant", "contravariantly").WithLocation(6, 29)
7116
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "E2").WithArguments("I2<T1, T2>.E2", "T2", "contravariant", "covariantly").WithLocation(5, 58),
7119
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "E3").WithArguments("I2<T1, T2>.E3", "T1", "covariant", "contravariantly").WithLocation(6, 60)
7148
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "I2<T2>").WithArguments("I2<T2>.operator +(I2<T2>)", "T2", "covariant", "contravariantly").WithLocation(4, 36),
7151
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "I3<T3>").WithArguments("I3<T3>.operator +(I3<T3>)", "T3", "covariant", "contravariantly").WithLocation(9, 36)
Symbols\SymbolErrorTests.cs (1)
16760
Diagnostic(ErrorCode.
ERR_UnexpectedVariance
, "T").WithArguments("Goo<T>.Baz(T)", "T", "covariant", "contravariantly").WithLocation(4, 14));