Bug 46190 - Overload resolution fails in a case where methods use a named parameter in different positions
Summary: Overload resolution fails in a case where methods use a named parameter in di...
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 4.6.0 (C8)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2016-10-31 15:28 UTC by Chris F Carroll
Modified: 2016-11-04 17:39 UTC (History)
1 user (show)

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

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:
Status:
RESOLVED FIXED

Description Chris F Carroll 2016-10-31 15:28:11 UTC
mcs v4.6.1.0 fails to identify an applicable function member when one exists, in the short code sample below.
The code sample compiles and runs under .Net 4 on Windows but does not compile under mcs.
-----------------------
Expected: Successful compilation
Actual: "error CS1744: Named argument `paramNamed' cannot be used for a parameter which has positional argument specified"
-----------------------
using System;
namespace BugDemos
{
 internal class Program
 {
   public static void Main(string[] args)
   {
    Method(1, 2, paramNamed: 3);
    //Output on .Net 4 is:
    //
    //Resolved to: Method(int p1, int p2, object paramNamed)
    //
   }
   static void Method(int p1, int paramNamed, int p3) { Console.WriteLine("Resolved to: Method(int p1, int paramNamed, int p3)");}
   static void Method(int p1, int p2, object paramNamed) { Console.WriteLine("Resolved to: Method(int p1, int p2, object paramNamed)");}
 }
}
Comment 1 Marek Safar 2016-11-04 17:39:18 UTC
Fixed in master and Mono 4.8