Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"More generic" tie-breaker not applied to ValueTuple in C# 7 compiler #20494

Closed
gafter opened this issue Jun 28, 2017 · 1 comment · Fixed by #20587
Closed

"More generic" tie-breaker not applied to ValueTuple in C# 7 compiler #20494

gafter opened this issue Jun 28, 2017 · 1 comment · Fixed by #20587
Assignees
Labels
Area-Compilers Bug Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented Tenet-Compatibility Violation of forwards/backwards compatibility in a design-time piece.
Milestone

Comments

@gafter
Copy link
Member

gafter commented Jun 28, 2017

Version Used: 15.2

Steps to Reproduce:

  1. Compile the following code

Expected Behavior:

Code compiles without problem, just like it did using previous C# compilers.

Actual Behavior:

Compile fails at M2(b), complaining that error CS0121: The call is ambiguous between the following methods or properties: 'C.M2<T>((T, int))' and 'C.M2<T>(((T, int), int))'

This is a regression from compilers previous to Visual Studio 2017.

using System;
public class C
{
    public static void Main()
    {
        A<A<int>> a = null;
        M1(a); // ok, selects M1<T>(A<A<T>> a)

        var b = default(ValueTuple<ValueTuple<int, int>, int>);
        M2(b); // ok, should select M2<T>(ValueTuple<ValueTuple<T, int>, int> a)
    }
    public static void M1<T>(A<T> a) { }
    public static void M1<T>(A<A<T>> a) { }

    public static void M2<T>(ValueTuple<T, int> a) { }
    public static void M2<T>(ValueTuple<ValueTuple<T, int>, int> a) { }
}

public class A<T> { }

/cc @jaredpar @MadsTorgersen

@gafter gafter added Area-Compilers Bug Tenet-Compatibility Violation of forwards/backwards compatibility in a design-time piece. labels Jun 28, 2017
@gafter gafter self-assigned this Jun 28, 2017
@gafter gafter added this to the 15.5 milestone Jun 28, 2017
@gafter
Copy link
Member Author

gafter commented Jun 28, 2017

This is related to a compiler API issue we discussed in the C# 7 timeframe: tuple types are reported as having arity zero. This bug (reported above) should be fixed, but we should also look at making the symbol API agree with the language specification.

gafter added a commit to gafter/roslyn that referenced this issue Jun 30, 2017
@gafter gafter added 4 - In Review A fix for the issue is submitted for review. and removed 3 - Working labels Jun 30, 2017
@gafter gafter added Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented and removed 4 - In Review A fix for the issue is submitted for review. labels Jul 9, 2017
gafter added a commit that referenced this issue Jul 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Bug Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented Tenet-Compatibility Violation of forwards/backwards compatibility in a design-time piece.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant