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

"No suitable Deconstruct instance or extension method was found" is incorrect #31031

Closed
gafter opened this issue Nov 7, 2018 · 2 comments
Closed
Assignees
Labels
Area-Compilers Bug Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings. New Language Feature - Tuples Tuples
Milestone

Comments

@gafter
Copy link
Member

gafter commented Nov 7, 2018

Compiling the following reports (among other things) that CS8129 No suitable Deconstruct instance or extension method was found for type 'IA', with 2 out parameters and a void return type.

using System;

class Program
{
    static void Main()
    {
        IA a = new A();
        (var x, var y) = a;
    }
}
interface I1
{
    void Deconstruct(out int X, out int Y);
}
interface I2
{
    void Deconstruct(out int X, out int Y);
}
interface IA : I1, I2 { }
class A : IA, I1, I2
{
    void I1.Deconstruct(out int X, out int Y) => (X, Y) = (3, 4);
    void I2.Deconstruct(out int X, out int Y) => (X, Y) = (7, 8);
}

However, there are indeed suitable Deconstruct instance methods for type IA. In fact there are too many of them. This diagnostic is simply incorrect.

@gafter
Copy link
Member Author

gafter commented Nov 7, 2018

See also #25533

@gafter gafter added Bug Area-Compilers Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings. New Language Feature - Tuples Tuples labels Nov 7, 2018
@gafter gafter added this to the 16.0 milestone Nov 7, 2018
@gafter gafter self-assigned this Nov 8, 2018
gafter added a commit to gafter/roslyn that referenced this issue Nov 8, 2018
* Permit 0-element and 1-element tuple patterns
Fixes dotnet#30962
Replaces dotnet#31027

* Handle null and nullable input for a var pattern with a tuple designation
Fixes dotnet#30906
Replaces dotnet#30935

* Don't report missing Deconstruct when there is more than one applicable Deconstruct
Fixes dotnet#31031
@gafter gafter added this to Working/In Review in Compiler: Pattern-Matching Nov 9, 2018
gafter pushed a commit that referenced this issue Nov 29, 2018
…31056)

* Permit the use of ITuple when Deconstruct exists but is ambiguous.

* Permit 0-element and 1-element tuple patterns
Fixes #30962
Replaces #31027

* Handle null and nullable input for a var pattern with a tuple designation
Fixes #30906
Replaces #30935

* Don't report missing Deconstruct when there is more than one applicable Deconstruct
Fixes #31031
@gafter
Copy link
Member Author

gafter commented Nov 29, 2018

Fixed in #31056

@gafter gafter closed this as completed Nov 29, 2018
@gafter gafter removed this from Working/In Review in Compiler: Pattern-Matching Nov 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Bug Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings. New Language Feature - Tuples Tuples
Projects
None yet
Development

No branches or pull requests

1 participant