This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 6541 - overload resolution should prefer non-params overload
: overload resolution should prefer non-params overload
Product: Compilers
Classification: Mono
Component: C#
: unspecified
: PC Windows
: --- normal
: ---
Assigned To: Marek Safar
  Show dependency treegraph
Reported: 2012-08-15 12:14 EDT by Jay Bazuzi
Modified: 2012-08-16 06:55 EDT (History)
1 user (show)

See Also:

Test case for params overload bug. (313 bytes, text/plain)
2012-08-15 12:14 EDT, Jay Bazuzi

Description Jay Bazuzi 2012-08-15 12:14:43 EDT
Created attachment 2353 [details]
Test case for params overload bug.

If you have 2 overloads with params, where all the parameters are of the same
type, MCS can pick the one. Like this:

    void F(string s, params string[] strings);          // overload A
    void F(params string[] strings);                    // overload B

    F("x");                                             // Should resolve to
overload A

In my tests, Microsoft's C# compiler selects overload A, while MCD selects
overload B.

Full test case attached.
Comment 1 Jay Bazuzi 2012-08-15 12:15:13 EDT
I ran in to this while using the Irony Parser's `RegexBasedTerminal` class. The
ctor has these overloads. (
Comment 2 Marek Safar 2012-08-16 06:55:50 EDT
Fixed in master

Note You need to log in before you can comment on or make changes to this bug.