diff --git a/corpus/expressions.txt b/corpus/expressions.txt index 43d6ba511..b98c8e9e0 100644 --- a/corpus/expressions.txt +++ b/corpus/expressions.txt @@ -1065,6 +1065,8 @@ object O { } { b => if (c) d.e } + { a => implicit b => b } + { (a: Int) ?=> (b: Int) => b } } -------------------------------------------------------------------------------- @@ -1137,7 +1139,25 @@ object O { (identifier)) (field_expression (identifier) - (identifier))))))))) + (identifier)))))) + (block + (lambda_expression + (identifier) + (lambda_expression + (identifier) + (identifier)))) + (block + (lambda_expression + (bindings + (binding + (identifier) + (type_identifier))) + (lambda_expression + (bindings + (binding + (identifier) + (type_identifier))) + (identifier))))))) ================================================================================ Unit expressions diff --git a/grammar.js b/grammar.js index a1babbddb..2cfa8ea4f 100644 --- a/grammar.js +++ b/grammar.js @@ -90,6 +90,7 @@ module.exports = grammar({ [$.class_parameters], // 'for' operator_identifier ':' _annotated_type • ':' … [$._type, $.compound_type], + [$.lambda_expression, $.modifiers], ], word: $ => $._alpha_identifier, @@ -1051,8 +1052,15 @@ module.exports = grammar({ lambda_expression: $ => prec.right( seq( - field("parameters", choice($.bindings, $._identifier, $.wildcard)), - "=>", + field( + "parameters", + choice( + $.bindings, + seq(optional("implicit"), $._identifier), + $.wildcard, + ), + ), + choice("=>", "?=>"), $._indentable_expression, ), ), diff --git a/script/smoke_test.sh b/script/smoke_test.sh index bab4ff26a..8e6fa08a6 100755 --- a/script/smoke_test.sh +++ b/script/smoke_test.sh @@ -3,7 +3,7 @@ # This is an integration test to generally check the quality of parsing. SCALA_SCALA_LIBRARY_EXPECTED=100 -SCALA_SCALA_COMPILER_EXPECTED=95 +SCALA_SCALA_COMPILER_EXPECTED=96 DOTTY_COMPILER_EXPECTED=83 SYNTAX_COMPLEXITY_CEILING=1300