Project

General

Profile

Actions

Bug #19973

closed

Duplicate keyword argument names don't always warn

Added by tenderlovemaking (Aaron Patterson) 7 months ago. Updated 3 months ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.3.0dev (2023-10-24T19:38:50Z cleanup 3525a9bd22) [arm64-darwin23]
[ruby-core:115169]

Description

Calling a method with duplicate keyword arguments doesn't warn when it could:

def bar a:, b:
  a + b
end

# Warning
bar(a: 1, b: 3, a: 2)

z = { b: 123 }
# No warning
bar(a: 1, **z, a: 2)

The first call to bar gives a warning about duplicate keyword args, but the second call doesn't. I think both cases should emit a warning.

Actions

Also available in: Atom PDF

Like1
Like0Like1Like0Like0