Bug 28837

Summary: Problems determining overloading candidate
Product: [Mono] Compilers Reporter: gaiseras
Component: C#Assignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: mono-bugs+mono
Priority: ---    
Version: 3.12.0   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:

Description gaiseras 2015-04-07 07:57:05 UTC
The following source code

<<<
public class B
{}


public class AClass
{
  public static int Foo(System.Type t, bool b = false, int x = 0)
  {
        return 1;
  }
  public static int Foo(System.Type t, params int[] x)
  {
        return 2;
  }
  public static int Foo(System.Type t, params B[] x)
  {
        return 3;
  }

  public static void Main()
  {
    B b = new B();
    System.Console.WriteLine(Foo(b.GetType()));
  } 
}

>>> 

produces ambiguity errors with mcs:
<<<
foo.cs(26,5): error CS0121: The call is ambiguous between the following methods or properties: `AClass.Foo(System.Type, params int[])' and `AClass.Foo(System.Type, params B[])'
foo.cs(13,21): (Location of the symbol related to previous error)
foo.cs(17,21): (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings
>>>

However, mono version 3.8 (and csc) seems to work fine with the code.
According to 7.5.3.2 from the C# language spec (5.0), the first method should be chosen (I think),
because it can be applied in the call below in its normal form?
Comment 1 Marek Safar 2015-04-07 11:58:35 UTC
Fixed in master