ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:72429] [Ruby trunk - Bug #11860] [Open] Double splat does not work on empty hash assigned via variable
       [not found] <redmine.issue-11860.20151222083354@ruby-lang.org>
@ 2015-12-22  8:33 ` sawadatsuyoshi
  2015-12-22  8:35 ` [ruby-core:72430] [Ruby trunk - Bug #11860] " sawadatsuyoshi
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: sawadatsuyoshi @ 2015-12-22  8:33 UTC (permalink / raw)
  To: ruby-core

Issue #11860 has been reported by Tsuyoshi Sawada.

----------------------------------------
Bug #11860: Double splat does not work on empty hash assigned via variable
https://bugs.ruby-lang.org/issues/11860

* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 2.3.0preview2 (2015-12-11 trunk 53028) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
When an empty hash is given as a literal, the double splat operates on it, and leaves nothing, which is expected.

    class String
      def foo; end
    end

    [**{}] # => []
    "foo".foo(**{}) # => nil
    "foo".send(**{}) # => nil

However, when an empty hash is given via variable, the double splat retains an empty hash in place.

    h = {}

    [**h] # => [{}]
    "foo".foo(**h) # => wrong number of arguments (given 1, expected 0)
    "foo".send(**h) # => wrong number of arguments (given 1, expected 0)



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:72430] [Ruby trunk - Bug #11860] Double splat does not work on empty hash assigned via variable
       [not found] <redmine.issue-11860.20151222083354@ruby-lang.org>
  2015-12-22  8:33 ` [ruby-core:72429] [Ruby trunk - Bug #11860] [Open] Double splat does not work on empty hash assigned via variable sawadatsuyoshi
@ 2015-12-22  8:35 ` sawadatsuyoshi
  2015-12-22 10:59 ` [ruby-core:72431] " sawadatsuyoshi
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: sawadatsuyoshi @ 2015-12-22  8:35 UTC (permalink / raw)
  To: ruby-core

Issue #11860 has been updated by Tsuyoshi Sawada.


Sorry, the `send` examples were wrong. They should be:

    "foo".send("foo", **{}) # => nil

    "foo".send("foo", **h) # => wrong number of arguments (given 1, expected 0)

----------------------------------------
Bug #11860: Double splat does not work on empty hash assigned via variable
https://bugs.ruby-lang.org/issues/11860#change-55723

* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 2.3.0preview2 (2015-12-11 trunk 53028) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
When an empty hash is given as a literal, the double splat operates on it, and leaves nothing, which is expected.

    class String
      def foo; end
    end

    [**{}] # => []
    "foo".foo(**{}) # => nil
    "foo".send(**{}) # => nil

However, when an empty hash is given via variable, the double splat retains an empty hash in place.

    h = {}

    [**h] # => [{}]
    "foo".foo(**h) # => wrong number of arguments (given 1, expected 0)
    "foo".send(**h) # => wrong number of arguments (given 1, expected 0)



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:72431] [Ruby trunk - Bug #11860] Double splat does not work on empty hash assigned via variable
       [not found] <redmine.issue-11860.20151222083354@ruby-lang.org>
  2015-12-22  8:33 ` [ruby-core:72429] [Ruby trunk - Bug #11860] [Open] Double splat does not work on empty hash assigned via variable sawadatsuyoshi
  2015-12-22  8:35 ` [ruby-core:72430] [Ruby trunk - Bug #11860] " sawadatsuyoshi
@ 2015-12-22 10:59 ` sawadatsuyoshi
  2016-02-14 16:48 ` [ruby-core:73811] [Ruby trunk Bug#11860] " justcolin
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: sawadatsuyoshi @ 2015-12-22 10:59 UTC (permalink / raw)
  To: ruby-core

Issue #11860 has been updated by Tsuyoshi Sawada.


I found more cases (other than via variable) that the double splat does not work on an empty hash. While parenthesis does not cause the issue:

    [**({})] # => []

expressions more complicated than that seem to cause the issue:

    [**({} if true)] # => [{}]
    [**(if true; {} end)] # => [{}]
    [**(false ? :foo : {})] # => [{}]


----------------------------------------
Bug #11860: Double splat does not work on empty hash assigned via variable
https://bugs.ruby-lang.org/issues/11860#change-55725

* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 2.3.0preview2 (2015-12-11 trunk 53028) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
When an empty hash is given as a literal, the double splat operates on it, and leaves nothing, which is expected.

    class String
      def foo; end
    end

    [**{}] # => []
    "foo".foo(**{}) # => nil
    "foo".send(**{}) # => nil

However, when an empty hash is given via variable, the double splat retains an empty hash in place.

    h = {}

    [**h] # => [{}]
    "foo".foo(**h) # => wrong number of arguments (given 1, expected 0)
    "foo".send(**h) # => wrong number of arguments (given 1, expected 0)



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:73811] [Ruby trunk Bug#11860] Double splat does not work on empty hash assigned via variable
       [not found] <redmine.issue-11860.20151222083354@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2015-12-22 10:59 ` [ruby-core:72431] " sawadatsuyoshi
@ 2016-02-14 16:48 ` justcolin
  2016-03-08  4:32 ` [ruby-core:74216] " sawadatsuyoshi
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: justcolin @ 2016-02-14 16:48 UTC (permalink / raw)
  To: ruby-core

Issue #11860 has been updated by Colin Fulton.


A similar bug happens when using the double splat operator in the parameter list of a method definition. See #12022.

----------------------------------------
Bug #11860: Double splat does not work on empty hash assigned via variable
https://bugs.ruby-lang.org/issues/11860#change-56989

* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 2.3.0preview2 (2015-12-11 trunk 53028) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
When an empty hash is given as a literal, the double splat operates on it, and leaves nothing, which is expected.

    class String
      def foo; end
    end

    [**{}] # => []
    "foo".foo(**{}) # => nil
    "foo".send(**{}) # => nil

However, when an empty hash is given via variable, the double splat retains an empty hash in place.

    h = {}

    [**h] # => [{}]
    "foo".foo(**h) # => wrong number of arguments (given 1, expected 0)
    "foo".send(**h) # => wrong number of arguments (given 1, expected 0)



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:74216] [Ruby trunk Bug#11860] Double splat does not work on empty hash assigned via variable
       [not found] <redmine.issue-11860.20151222083354@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2016-02-14 16:48 ` [ruby-core:73811] [Ruby trunk Bug#11860] " justcolin
@ 2016-03-08  4:32 ` sawadatsuyoshi
  2016-05-17  8:24 ` [ruby-core:75553] " nobu
  2019-09-02 15:28 ` [ruby-core:94746] [Ruby master " merch-redmine
  6 siblings, 0 replies; 7+ messages in thread
From: sawadatsuyoshi @ 2016-03-08  4:32 UTC (permalink / raw)
  To: ruby-core

Issue #11860 has been updated by Tsuyoshi Sawada.


This bug is related to #10708.

----------------------------------------
Bug #11860: Double splat does not work on empty hash assigned via variable
https://bugs.ruby-lang.org/issues/11860#change-57352

* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 2.3.0preview2 (2015-12-11 trunk 53028) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
When an empty hash is given as a literal, the double splat operates on it, and leaves nothing, which is expected.

    class String
      def foo; end
    end

    [**{}] # => []
    "foo".foo(**{}) # => nil
    "foo".send(**{}) # => nil

However, when an empty hash is given via variable, the double splat retains an empty hash in place.

    h = {}

    [**h] # => [{}]
    "foo".foo(**h) # => wrong number of arguments (given 1, expected 0)
    "foo".send(**h) # => wrong number of arguments (given 1, expected 0)



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:75553] [Ruby trunk Bug#11860] Double splat does not work on empty hash assigned via variable
       [not found] <redmine.issue-11860.20151222083354@ruby-lang.org>
                   ` (4 preceding siblings ...)
  2016-03-08  4:32 ` [ruby-core:74216] " sawadatsuyoshi
@ 2016-05-17  8:24 ` nobu
  2019-09-02 15:28 ` [ruby-core:94746] [Ruby master " merch-redmine
  6 siblings, 0 replies; 7+ messages in thread
From: nobu @ 2016-05-17  8:24 UTC (permalink / raw)
  To: ruby-core

Issue #11860 has been updated by Nobuyoshi Nakada.

Description updated

----------------------------------------
Bug #11860: Double splat does not work on empty hash assigned via variable
https://bugs.ruby-lang.org/issues/11860#change-58684

* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 2.3.0preview2 (2015-12-11 trunk 53028) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
When an empty hash is given as a literal, the double splat operates on it, and leaves nothing, which is expected.

```ruby
class String
  def foo; end
end

[**{}] # => []
"foo".foo(**{}) # => nil
"foo".send(**{}) # => nil
```

However, when an empty hash is given via variable, the double splat retains an empty hash in place.

```ruby
h = {}

[**h] # => [{}]
"foo".foo(**h) # => wrong number of arguments (given 1, expected 0)
"foo".send(**h) # => wrong number of arguments (given 1, expected 0)
```




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:94746] [Ruby master Bug#11860] Double splat does not work on empty hash assigned via variable
       [not found] <redmine.issue-11860.20151222083354@ruby-lang.org>
                   ` (5 preceding siblings ...)
  2016-05-17  8:24 ` [ruby-core:75553] " nobu
@ 2019-09-02 15:28 ` merch-redmine
  6 siblings, 0 replies; 7+ messages in thread
From: merch-redmine @ 2019-09-02 15:28 UTC (permalink / raw)
  To: ruby-core

Issue #11860 has been updated by jeremyevans0 (Jeremy Evans).

Status changed from Open to Closed

With recent commits to the master branch, keyword splats of empty hashes do not pass positional arguments to methods or cause an empty hash to be added to an array.

----------------------------------------
Bug #11860: Double splat does not work on empty hash assigned via variable
https://bugs.ruby-lang.org/issues/11860#change-81363

* Author: sawa (Tsuyoshi Sawada)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.3.0preview2 (2015-12-11 trunk 53028) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
When an empty hash is given as a literal, the double splat operates on it, and leaves nothing, which is expected.

```ruby
class String
  def foo; end
end

[**{}] # => []
"foo".foo(**{}) # => nil
"foo".send("foo", **{}) # => nil
```

However, when an empty hash is given via variable, the double splat retains an empty hash in place.

```ruby
h = {}

[**h] # => [{}]
"foo".foo(**h) # => wrong number of arguments (given 1, expected 0)
"foo".send("foo", **h) # => wrong number of arguments (given 1, expected 0)
```




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-09-02 15:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-11860.20151222083354@ruby-lang.org>
2015-12-22  8:33 ` [ruby-core:72429] [Ruby trunk - Bug #11860] [Open] Double splat does not work on empty hash assigned via variable sawadatsuyoshi
2015-12-22  8:35 ` [ruby-core:72430] [Ruby trunk - Bug #11860] " sawadatsuyoshi
2015-12-22 10:59 ` [ruby-core:72431] " sawadatsuyoshi
2016-02-14 16:48 ` [ruby-core:73811] [Ruby trunk Bug#11860] " justcolin
2016-03-08  4:32 ` [ruby-core:74216] " sawadatsuyoshi
2016-05-17  8:24 ` [ruby-core:75553] " nobu
2019-09-02 15:28 ` [ruby-core:94746] [Ruby master " merch-redmine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).