Bug 6541 - overload resolution should prefer non-params overload
Summary: overload resolution should prefer non-params overload
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2012-08-15 12:14 UTC by Jay Bazuzi
Modified: 2012-08-16 06:55 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Jay Bazuzi 2012-08-15 12:14:43 UTC
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 UTC
I ran in to this while using the Irony Parser's `RegexBasedTerminal` class. The ctor has these overloads. (http://irony.codeplex.com)
Comment 2 Marek Safar 2012-08-16 06:55:50 UTC
Fixed in master