diff --git a/parser/src/python.lalrpop b/parser/src/python.lalrpop index 07b6ec3b6..8ce1d2157 100644 --- a/parser/src/python.lalrpop +++ b/parser/src/python.lalrpop @@ -663,7 +663,7 @@ Test: ast::Expression = { }; LambdaDef: ast::Expression = { - "lambda" ":" => + "lambda" ":" => ast::Expression::Lambda { args: p.unwrap_or(Default::default()), body:Box::new(b) diff --git a/tests/snippets/funky_syntax.py b/tests/snippets/funky_syntax.py index 7cb718de3..28ef5964d 100644 --- a/tests/snippets/funky_syntax.py +++ b/tests/snippets/funky_syntax.py @@ -5,4 +5,10 @@ assert b == 6 c = 2 + 4 if a > 5 else 'boe' assert c == 'boe' +d = lambda x, y: x > y +assert d(5, 4) + +e = lambda x: 1 if x else 0 +assert e(True) == 1 +assert e(False) == 0