diff --git a/examples/expressions.fs b/examples/expressions.fs index 1292d46e0..9970ac513 100644 --- a/examples/expressions.fs +++ b/examples/expressions.fs @@ -1 +1,9 @@ -let disposables = new Disposables.CompositeDisposable() +namespace Bad + +type A() = + member this.Curried (x: int) (y: int) = x + y + +module Program = + + [] + let main args = () diff --git a/grammar.js b/grammar.js index 67b857ab4..f21573238 100644 --- a/grammar.js +++ b/grammar.js @@ -253,7 +253,7 @@ module.exports = grammar({ prec.left(3, seq( optional('inline'), optional($.access_modifier), - $._identifier_or_op, + prec(100, $._identifier_or_op), optional($.type_arguments), $.argument_patterns, optional(seq(':', $.type)), diff --git a/src/grammar.json b/src/grammar.json index 1ede30e8d..7bb917fae 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -671,8 +671,12 @@ ] }, { - "type": "SYMBOL", - "name": "_identifier_or_op" + "type": "PREC", + "value": 100, + "content": { + "type": "SYMBOL", + "name": "_identifier_or_op" + } }, { "type": "CHOICE", diff --git a/test/corpus/function_defn.txt b/test/corpus/function_defn.txt index c0e4f9245..64c4f23f3 100644 --- a/test/corpus/function_defn.txt +++ b/test/corpus/function_defn.txt @@ -221,3 +221,39 @@ let inline double<'a when 'a:(member Double: unit -> 'a)> (x: 'a) = x.Double() (long_identifier (identifier) (identifier))))))) + +================================================================================ +function decl should be preferred over value decl +================================================================================ + +namespace Test + +module Program = + [] + let main args = + () + +-------------------------------------------------------------------------------- + +(file + (namespace + (long_identifier + (identifier)) + (module_defn + (identifier) + (value_declaration + (attributes + (attribute_set + (attribute + (object_construction + (type + (long_identifier + (identifier))))))) + (function_or_value_defn + (function_declaration_left + (identifier) + (argument_patterns + (long_identifier + (identifier)))) + (const + (unit)))))))