Project

General

Profile

Actions

Bug #19278

closed

Constructing subclasses of Data with positional arguments

Added by tenderlovemaking (Aaron Patterson) over 1 year ago. Updated over 1 year ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 3.2.0 (2022-12-25 revision a528908271) [arm64-darwin22]
[ruby-core:111484]

Description

I'd expect both of the following subclasses to work, but the subclass that uses positional parameters raises an exception:

Foo = Data.define

class Bar < Foo
  def initialize foo:
    p foo
  end
end

class Baz < Foo
  def initialize foo
    p foo
  end
end

Bar.new foo: 1 # Prints 1
Baz.new 1    # Raises ArgumentError

I'd expect the subclass that uses positional arguments to work.


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #19301: Fix Data class to report keyrest instead of rest parametersRejectedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0