Project

General

Profile

Actions

Bug #19973

closed

Duplicate keyword argument names don't always warn

Added by tenderlovemaking (Aaron Patterson) 6 months ago. Updated 2 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.

Updated by nobu (Nobuyoshi Nakada) 6 months ago

  • Backport changed from 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN to 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED
Actions #2

Updated by nobu (Nobuyoshi Nakada) 6 months ago

  • Status changed from Open to Closed

Applied in changeset git|c8d162c889008028b148437d02f36f4edaa749fd.


[Bug #19973] Warn duplicated keyword arguments after keyword splat

Updated by nagachika (Tomoyuki Chikanaga) 2 months ago

  • Backport changed from 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED to 3.0: REQUIRED, 3.1: REQUIRED, 3.2: DONE

ruby_3_2 24dd529750c08b5603fb418a4f34998b9bf6c8f9 merged revision(s) c8d162c889008028b148437d02f36f4edaa749fd.

Updated by nagachika (Tomoyuki Chikanaga) 2 months ago

  • Backport changed from 3.0: REQUIRED, 3.1: REQUIRED, 3.2: DONE to 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED

reverted backport commit at 1b9ff146e38c348519434754e0466352b8b25c50.
it cause CI failures.
http://rubyci.s3.amazonaws.com/ubuntu2204/ruby-3.2/log/20240225T042407Z.fail.html.gz

Actions

Also available in: Atom PDF

Like1
Like0Like1Like0Like0