Skip to content

Four errors instead of one for erroneous deconstruct #25533

@gafter

Description

@gafter

The following code

    public static void M(object o)
    {
        var (x, y) = o;
    }

Gets four errors when only one is deserved

error CS1061: 'object' does not contain a definition for 'Deconstruct' and no extension method 'Deconstruct' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
error CS8129: No suitable Deconstruct instance or extension method was found for type 'object', with 2 out parameters and a void return type.
error CS8130: Cannot infer the type of implicitly-typed deconstruction variable 'x'.
error CS8130: Cannot infer the type of implicitly-typed deconstruction variable 'y'.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions