Closure parameter list
dtolnay opened this issue · 3 comments
Yeah, I’ve noticed that as well. I am debating between just allowing | in Params, or using separate node types for closures.
I don‘t have a super great intuition for where to reuse nodes and where to use more refined types, but I lean towards reusing.
In Syn we use Signature
for all instances of function signatures involving fn
and a different representation for ExprClosure
, since the argument grammar is pretty different anyway beyond just the delimiters. For example you can always get the Type of a fn parameter from syntax, but not of a closure parameter.
For example you can always get the Type of a fn parameter from syntax, but not of a closure parameter.
Which is slightly different for rust-analyzer, where everything is optional. In fn foo(x: ) { }
there will be a Param node in the CST. So, any processing of params syntax needs to deal with missing types anyway, so there‘s less incentive to try to lift „is parameter optional“ to the type level.