dotnet/roslyn

Improve error recovery for explicit implementation lacking return type

Open

#61 563 ouverte le 27 mai 2022

Voir sur GitHub
 (1 commentaire) (0 réactions) (0 assignés)C# (4 257 forks)batch import
Area-CompilersConcept-Diagnostic Clarityhelp wanted

Métriques du dépôt

Stars
 (20 414 stars)
Métriques de merge PR
 (Merge moyen 6j 17h) (256 PRs mergées en 30 j)

Description

Version Used: e6b5dd830f1b790bd80e62272129cc040d0a2fdc

Steps to Reproduce:

SharpLab

interface I
{
    void F();
}

class C : I
{
    F() { }
    I.F() { }
}

Expected Behavior: F() { } and I.F() { } both parse as ConstructorDeclaration, which results in a "Method must have a return type" diagnostic.

Actual Behavior: Only F() parses as a ConstructorDeclaration, which results in some not as useful parsing diagnostics for I.F():

error CS1519: Invalid token '(' in class, record, struct, or interface member declaration error CS8124: Tuple must contain at least two elements. error CS1519: Invalid token '{' in class, record, struct, or interface member declaration error CS1022: Type or namespace definition, or end-of-file expected

Guide contributeur