|
Project
|
ReSharper
|
|
Priority
|
Critical |
|
Type
|
Bug |
|
Fix versions
|
5.0 |
|
State
|
Fixed |
|
Assignee
|
Olga Lobacheva |
|
Subsystem
|
PSI |
|
Affected versions
|
No Affected versions |
|
Fixed in build
|
5.0.1654.49 |
using System;
class B
{
public static void Foo<T>(T y, Func<T,T> x) { }
public static void Bar(Action<object> a) { }
public static void Bar(Action<string> a) { }
static void Main()
{
Bar(y => Foo(y, a => a)); // error CS0121: The call is ambiguous between the following methods or properties: 'B.Bar(System.Action<object>)' and 'B.Bar(System.Action<string>)'
}
}
The code does not compile, but Resharper's error indicator is green.
using System; public delegate void Action<in T>(T t); class B { public static void Bar(Action<object> a) { } public static void Bar(Action<string> a) { } static void Main() { Bar(y => Main()); // error CS0121: The call is ambiguous between the following methods or properties: 'B.Bar(System.Action<object>)' and 'B.Bar(System.Action<string>)' Bar(null); // OK Action<object> x = null; Action<string> s = x; } }