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# (show other bugs)
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)

See Also:
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

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

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