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

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


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

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

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.


Create a new report for Bug 6541 on Developer Community or GitHub if you have new information to add and do not yet see a matching report.

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments


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.

Related Links: