Project

General

Profile

ActionsLike0

Bug #19619

closed

Numbered parameters don't work with method definition with parameters

Added by okuramasafumi (Masafumi OKURA) about 2 years ago. Updated 9 months ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:113352]

Description

This works:

class Foo
  def bar(baz) = 'foo'
end

p Foo.new.bar('baz')

This also works:

o = Object.new
o.tap { |obj| def obj.bar(baz) = 'foo' }
p o.bar('baz')

Even this works:

o = Object.new
o.tap { def _1.bar = 'foo' }
p o.bar

But this DOESN'T work:

o = Object.new
o.tap { def _1.bar(baz) = 'foo' }
p o.bar('baz')

So, when we define a method with parameters on an instance given as numbered parameters, it doesn't work. If we change one condition (definition way, parameter existence, and so on), it works.

ActionsLike0

Also available in: Atom PDF