Improve error recovery for explicit implementation lacking return type
#61,563 opened on May 27, 2022
Repository metrics
- Stars
- (20,414 stars)
- PR merge metrics
- (Avg merge 6d 17h) (256 merged PRs in 30d)
Description
Version Used: e6b5dd830f1b790bd80e62272129cc040d0a2fdc
Steps to Reproduce:
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