Project

General

Profile

Actions

Bug #19280

closed

Wrong error message about arity of Data::define.new

Added by kyanagi (Kouhei Yanagita) almost 2 years ago. Updated almost 2 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.3.0dev (2022-12-28T16:43:05Z master cada537040) [x86_64-linux]
[ruby-core:111491]

Description

$ ~/work/r/bin/ruby -e 'Data.define(:a, :b).new(1, 2, 3)'
-e:1:in `new': wrong number of arguments (given 3, expected 0..2) (ArgumentError)

Data.define(:a, :b).new(1, 2, 3)
                        ^^^^^^^
        from -e:1:in `<main>'

On this message, "expected 2" is appropriate because fewer arguments are not allowed.

$ ~/work/r/bin/ruby -e 'Data.define(:a, :b).new(1)'
-e:1:in `initialize': missing keyword: :b (ArgumentError)

Data.define(:a, :b).new(1)
                        ^
        from -e:1:in `new'
        from -e:1:in `<main>'

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
Like0Like0