Fix empty lambda args range (#35)

Previously, empty lambda arguments (e.g. `lambda: 1`) would get the
range of the entire expression, which leads to incorrect comment
placement. Now empty lambda arguments get an empty range between the
`lambda` and the `:` tokens.
This commit is contained in:
konsti
2023-07-21 17:41:19 +02:00
committed by GitHub
parent fb365c642b
commit 4d03b9b5b2
5 changed files with 71 additions and 11 deletions

View File

@@ -636,6 +636,13 @@ mod tests {
insta::assert_debug_snapshot!(parse_ast);
}
#[test]
fn test_parse_lambda_no_args() {
let source = "lambda: 1";
let parse_ast = ast::Suite::parse(source, "<test>").unwrap();
insta::assert_debug_snapshot!(parse_ast);
}
#[test]
fn test_parse_tuples() {
let source = "a, b = 4, 5";