Bug 46190

Summary: Overload resolution fails in a case where methods use a named parameter in different positions
Product: [Mono] Compilers Reporter: Chris F Carroll <chris.carroll>
Component: C#Assignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: mono-bugs+mono
Priority: ---    
Version: 4.6.0 (C8)   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:

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