Skip to content

Commit a1fa782

Browse files
Simplify logic - return true after tuple+identifier check
Co-authored-by: CyrusNajmabadi <[email protected]>
1 parent dacb2da commit a1fa782

1 file changed

Lines changed: 2 additions & 16 deletions

File tree

src/Compilers/CSharp/Portable/Parser/LanguageParser.cs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8697,22 +8697,8 @@ private bool IsAnonymousDelegateExpression()
86978697
return false;
86988698
}
86998699

8700-
// If we didn't scan a valid tuple type, assume it's an anonymous delegate expression
8701-
// since delegate declarations must have a valid return type.
8702-
// This handles cases like: delegate (ref int i) { }
8703-
if (scanResult != ScanTypeFlags.TupleType)
8704-
{
8705-
return true;
8706-
}
8707-
8708-
// We have a tuple type but no identifier following - check for open brace
8709-
if (this.CurrentToken.Kind == SyntaxKind.OpenBraceToken)
8710-
{
8711-
return true;
8712-
}
8713-
8714-
// Default to delegate type declaration for other cases
8715-
return false;
8700+
// Otherwise, assume it's an anonymous delegate expression.
8701+
return true;
87168702
}
87178703

87188704
private bool IsPossibleNewExpression()

0 commit comments

Comments
 (0)