From: akr@... Date: 2018-09-18T17:12:31+00:00 Subject: [ruby-core:89074] [Ruby trunk Bug#15138] non-symbol keyword in double splat, such as **{2 => 3}, raises TypeError or not Issue #15138 has been reported by akr (Akira Tanaka). ---------------------------------------- Bug #15138: non-symbol keyword in double splat, such as **{2 => 3}, raises TypeError or not https://bugs.ruby-lang.org/issues/15138 * Author: akr (Akira Tanaka) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- I found that non-symbol keyword in double splat, such as `**{2 => 3}`, raises TypeError in a situation and doesn't raise in another situation: ``` % ./ruby -ve ' def m(*a) p a end m(k: 1, **{2 => 3}) # [{:k=>1, 2=>3}] m(**{4 => 5}) # hash key 4 is not a Symbol (TypeError) ' ruby 2.6.0dev (2018-09-18 trunk 64776) [x86_64-linux] [{:k=>1, 2=>3}] Traceback (most recent call last): -e:4:in `
': hash key 4 is not a Symbol (TypeError) ``` It seems another keyword argument, `k: 0` here, prevent TypeError. I think this behavior is not intentional. -- https://bugs.ruby-lang.org/ Unsubscribe: