Open cston opened 3 years ago
Compile:
class Program { static void F1<T>(T t, object o) { } static void F2<T>(T t, ref object o) { } static void Main() { _ = new[] { F1<object>, F1<string> }; // ok _ = new[] { F2<object>, F2<string> }; // error CS0826: No best type found for implicitly-typed array } }
Expected: Compiler infers a common delegate signature void *(object, ref object) for the second array.
void *(object, ref object)
Actual: (9,13): error CS0826: No best type found for implicitly-typed array
(9,13): error CS0826: No best type found for implicitly-typed array
Relates to test plan https://github.com/dotnet/roslyn/issues/52192
The type parameters for synthesized delegate types should have in variance for parameters passed by value and out variance for out parameters and return type.
in
out
Compile:
Expected: Compiler infers a common delegate signature
void *(object, ref object)
for the second array.Actual:
(9,13): error CS0826: No best type found for implicitly-typed array
Relates to test plan https://github.com/dotnet/roslyn/issues/52192