Actions
Bug #21003
closedunexpected warning about ignored block
Description
I stumbled upon this during the upgrade to 3.4. Here's the minimal repro:
$VERBOSE = true
def foo(*, &block) = block
def bar(buz, ...) = foo(buz, ...)
bar(:test) {}
It gives
ruby reproduce.rb
reproduce.rb:6: warning: the block passed to 'Object#bar' defined at reproduce.rb:4 may be ignored
where I believe it shouldn't. No warning reported if I change def bar(buz, ...)
to def bar(...)
.
Updated by byroot (Jean Boussier) 2 days ago
- Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN to 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: REQUIRED
Updated by ydah (Yudai Takada) 2 days ago
memo) This does not occur even in Ruby 3.4.1 when --parser=parse.y
.
❯ ruby --parser=parse.y -e '$VERBOSE = true
def foo(*, &block) = block
def bar(buz, ...) = foo(buz, ...)
bar(:test) {}'
~
❯ ruby --parser=parse.y -v -e '$VERBOSE = true
def foo(*, &block) = block
def bar(buz, ...) = foo(buz, ...)
bar(:test) {}'
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) [arm64-darwin23]
Updated by kddnewton (Kevin Newton) 1 day ago
- Assignee set to prism
Updated by kddnewton (Kevin Newton) 1 day ago
- Status changed from Open to Closed
Applied in changeset git|2a1cff40f5e7875f69a7d0ed59eab92cc86c65ff.
Do not warn unused block when using forwarding
Fixes [Bug #21003]
Actions
Like0
Like0Like0Like0Like0