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  
  • Created by   Vladimir Reshetnikov
    2 years ago (04 Nov 2009 00:14)
  • Updated by   Olga Lobacheva
    18 months ago (14 Jul 2010 18:52)
  • Jira: RSRP-128872
    (history, comments)
 
RSRP-128872 error CS0121: The call is ambiguous between the following methods or properties: 'B.Bar(System.Action<object>)' and 'B.Bar(System.Action<string>)'
0
Issue is visible to: All Users
  The issue is visible to the selected user group only
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>)'
    }
}
Comments (5)
 
History
 
Linked Issues (?)
 
TeamCity Changes (0)
 
Vladimir Reshetnikov
  Vladimir Reshetnikov
23 Dec 2009 15:13
2 years ago
I checked it in 1564.
The code does not compile, but Resharper's error indicator is green.
Olga Lobacheva
  Olga Lobacheva
23 Dec 2009 15:50
2 years ago
Its strange. Are you sure about build number? I checked it in 1560 and 1563 and latest binaries.
Olga Lobacheva
  Olga Lobacheva
23 Dec 2009 16:47
2 years ago
Reproduced in VS10. :)
Olga Lobacheva
  Olga Lobacheva
23 Dec 2009 16:51
2 years ago
Reduced example:

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;
  }
}
Olga Lobacheva
  Olga Lobacheva
24 Dec 2009 16:19
2 years ago