Bug 19754

Summary: Overload resolution should prefer overload with missing optional parameter over params
Product: [Mono] Compilers Reporter: Daniel Grunwald <grunwald>
Component: C#Assignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: mono-bugs+mono
Priority: ---    
Version: 3.4.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: Test case
Test case (fixed)

Description Daniel Grunwald 2014-05-14 06:09:52 UTC
Using Mono 3.4.0 or the current HEAD (1495baabf), compiling and running the attached program produces the output "FAIL". Doing the same with the Microsoft compiler (.NET 4.5.1) produces "PASS".

Overloads:
public static void M(object obj, bool b = false)
public static void M(object obj, params string[] args)

Call: M(null);

csc on .NET 4.5.1 picks M(object, params string[])
Mono 3.4.0 picks M(object, bool).
Comment 1 Daniel Grunwald 2014-05-14 06:11:07 UTC
Created attachment 6805 [details]
Test case
Comment 2 Marek Safar 2014-05-27 08:46:00 UTC
Tested with Mono and Microsoft (R) Visual C# Compiler version 12.0.30324.0 for C# 5 and both print FAIL for attached test case.
Comment 3 Daniel Grunwald 2014-05-28 10:29:04 UTC
Weird, I'll have to look into whether I made a mistake writing the reduced test case.
There's definitely a Mono bug somewhere here -- our software compiles fine with the Microsoft compiler and with Mono 3.2.3, but not with Mono 3.4.0.
Comment 4 Daniel Grunwald 2014-05-28 10:41:04 UTC
Created attachment 6890 [details]
Test case (fixed)

Sorry for the incorrect testcase, looks like I uploaded a different version of the file than I tested with.
The new testcase should demonstrate the bug.
Comment 5 Marek Safar 2014-05-28 12:02:40 UTC
Fixed in master