Actions
Bug #15789
closedParse error when numbered parameter is used in a lambda that is a default value of other optarg
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.0dev (2019-04-24 trunk cf930985da) [x86_64-darwin18]
Description
Sorry if the name of the ticket is not desccriptive
While working on backporting these commits into a parser gem:
https://github.com/ruby/ruby/commit/6ca9e7cc0785c33f6d382176dbd79d6c91db72fe
https://github.com/ruby/ruby/commit/ae07b66aaa092c59ac9d544c9b582712290dc357
... I've found a weird case that throws a SyntaxError:
> def m(a = ->{@1}); end
SyntaxError ((irb):10: ordinary parameter is defined)
def m(a = ->{@1}); end
^~
And same errors gets thrown when I pass a lambda with numparams to lambda optarg:
> ->(optarg = ->{@1}) {}
SyntaxError ((irb):1: ordinary parameter is defined)
->(optarg = ->{@1}) {}
^~
I guess the reason for that is that p->max_numparam should be organized as a stack, not a plain shared value.
Files
Actions
Like0
Like0Like0Like0Like0Like0Like0