ruby/test/prism/fixtures/lambda.txt
Earlopain d1a70014f9 [ruby/prism] Fix parser translator ast when using anonymous forwarding in blocks/lambda
Blocks and lambdas inherit anonymous arguments from the method they are a part of.
They themselves don't allow to introduce new anonymous arguments.
While you can write this:
```rb
def foo(*)
  bar { |**| }
end
```
referecing the new parameter inside of the block will always be a syntax error.

https://github.com/ruby/prism/commit/2cbd27e134
2025-01-11 19:09:05 -05:00

28 lines
177 B
Plaintext

->(
foo
) {}
->(x: "b#{a}") { }
->(a: b * 3) {}
-> foo = bar do end
-> foo: bar do end
def foo(*, **)
->() { bar(*, **) }
end
p{|a:
b|}
->(a:
b){}
->a:
b{}
->a:
{}