... because it treats all triple-dot tokens followed by newline between method-name and method-body as "forward argument".
I think I know how to fix it, there's a single flag for "being in a method arguments definition section", right now it's set once at the beginning of arglist (with a few exceptions that temporary unset-on-enter and restore-on-exit), and for example optional arguments do not affect it, but they should in a very similar way, push on reading default value, pop on leave.
This commit tracks upstream commit ruby/ruby@13a9597.
Closes https://github.com/whitequark/parser/issues/823.
Also I think I've found a bug in MRI implementation. This code is valid on 3.0:
It's a method with 1 argument that has a default value
1...2
. Current MRI/master gives an error:... because it treats all triple-dot tokens followed by newline between method-name and method-body as "forward argument".
I think I know how to fix it, there's a single flag for "being in a method arguments definition section", right now it's set once at the beginning of arglist (with a few exceptions that temporary unset-on-enter and restore-on-exit), and for example optional arguments do not affect it, but they should in a very similar way,
push
on reading default value,pop
on leave.Let's pretend it works as intended 👀