fix: fun decl vs value decl

pull/625/head^2
Nikolaj Sidorenco 2024-04-25 23:32:02 +07:00
parent 4357486c98
commit 03b3cfd077
No known key found for this signature in database
4 changed files with 52 additions and 4 deletions

@ -1 +1,9 @@
let disposables = new Disposables.CompositeDisposable()
namespace Bad
type A() =
member this.Curried (x: int) (y: int) = x + y
module Program =
[<EntryPoint>]
let main args = ()

@ -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)),

8
src/grammar.json generated

@ -671,8 +671,12 @@
]
},
{
"type": "SYMBOL",
"name": "_identifier_or_op"
"type": "PREC",
"value": 100,
"content": {
"type": "SYMBOL",
"name": "_identifier_or_op"
}
},
{
"type": "CHOICE",

@ -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 =
[<EntryPoint>]
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)))))))