diff --git a/corpus/definitions.txt b/corpus/definitions.txt index cabbd9eda..07aa6d1e5 100644 --- a/corpus/definitions.txt +++ b/corpus/definitions.txt @@ -1247,6 +1247,9 @@ object A: given [A](using Foo[A]): Foo[List[A]] with def x = () + trait B: + given c: Context[T] + -------------------------------------------------------------------------------- (compilation_unit @@ -1385,7 +1388,16 @@ object A: (with_template_body (function_definition (identifier) - (unit))))))) + (unit)))) + (trait_definition + (identifier) + (template_body + (given_definition + (identifier) + (generic_type + (type_identifier) + (type_arguments + (type_identifier))))))))) ================================================================================ Top-level Definitions (Scala 3 syntax) diff --git a/grammar.js b/grammar.js index 0044ccb17..e863f02ca 100644 --- a/grammar.js +++ b/grammar.js @@ -595,8 +595,9 @@ module.exports = grammar({ field("return_type", $._structural_instance), seq( field("return_type", $._annotated_type), - "=", - field("body", $._indentable_expression), + optional( + seq("=", field("body", $._indentable_expression)) + ), ), ), ),