Ignore colon-after-lambda in compound statement rules (#2771)

This commit is contained in:
Charlie Marsh 2023-02-11 12:22:53 -05:00 committed by GitHub
parent 77099dcd4d
commit 43b7ee215c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View file

@ -44,3 +44,5 @@ a: List[str] = []
#:
if a := 1:
pass
#:
func = lambda x: x** 2 if cond else lambda x:x

View file

@ -182,6 +182,21 @@ pub fn compound_statements(lxr: &[LexResult]) -> Vec<Diagnostic> {
}
match tok {
Tok::Lambda => {
// Reset.
def = None;
colon = None;
class = None;
elif = None;
else_ = None;
except = None;
finally = None;
for_ = None;
if_ = None;
try_ = None;
while_ = None;
with = None;
}
Tok::If => {
if_ = Some((start, end));
}