* [ruby-core:90356] [Ruby trunk Bug#15389] 8 elements or more larger Hash doesn't show an entry
[not found] <redmine.issue-15389.20181207042515@ruby-lang.org>
@ 2018-12-07 4:25 ` kou
2018-12-07 9:30 ` [ruby-core:90362] [Ruby trunk Bug#15389] 9 " hanmac
1 sibling, 0 replies; 2+ messages in thread
From: kou @ 2018-12-07 4:25 UTC (permalink / raw)
To: ruby-core
Issue #15389 has been reported by kou (Kouhei Sutou).
----------------------------------------
Bug #15389: 8 elements or more larger Hash doesn't show an entry
https://bugs.ruby-lang.org/issues/15389
* Author: kou (Kouhei Sutou)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.0dev (2018-12-05 trunk 66213) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
I don't know this problem is a problem of Racc or Ruby itself yet but I'll share this.
Here is a Ruby script that reproduce this case:
```ruby
require "racc/grammar"
hash = {}
[
[false, 0],
[:error, 1],
[:END, 2],
[:CLASS, 3],
[:RULE, 4],
[:"<", 5],
[:SYMBOL, 6],
[:":", 7],
[:CONV, 8],
].each do |value, ident|
sym = Racc::Sym.new(value, false)
sym.ident = ident
hash[sym] = ident
end
p hash
```
It outputs the following:
```text
{error=>1, END=>2, CLASS=>3, RULE=>4, <=>5, SYMBOL=>6, :=>7, CONV=>8}
```
It doesn't have an entry for `[false, 0]`.
If we reduce the last entry (`[:CONV, 8]`), we can see the entry for `[false, 0]`:
```ruby
require "racc/grammar"
hash = {}
[
[false, 0],
[:error, 1],
[:END, 2],
[:CLASS, 3],
[:RULE, 4],
[:"<", 5],
[:SYMBOL, 6],
[:":", 7],
].each do |value, ident|
sym = Racc::Sym.new(value, false)
sym.ident = ident
hash[sym] = ident
end
p hash
```
```text
{$end=>0, error=>1, END=>2, CLASS=>3, RULE=>4, <=>5, SYMBOL=>6, :=>7}
```
(`$end=>0` is the entry for `[false, 0]`.)
This is occurred since r65454.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
* [ruby-core:90362] [Ruby trunk Bug#15389] 9 elements or more larger Hash doesn't show an entry
[not found] <redmine.issue-15389.20181207042515@ruby-lang.org>
2018-12-07 4:25 ` [ruby-core:90356] [Ruby trunk Bug#15389] 8 elements or more larger Hash doesn't show an entry kou
@ 2018-12-07 9:30 ` hanmac
1 sibling, 0 replies; 2+ messages in thread
From: hanmac @ 2018-12-07 9:30 UTC (permalink / raw)
To: ruby-core
Issue #15389 has been updated by Hanmac (Hans Mackowiak).
@kou you need to debug what sym is, it looks like that it thinks that some of them are already existing
it might also be a bad idea to use such objects as hash keys?
Or debug why hash thinks it already has that key?
----------------------------------------
Bug #15389: 9 elements or more larger Hash doesn't show an entry
https://bugs.ruby-lang.org/issues/15389#change-75473
* Author: kou (Kouhei Sutou)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.0dev (2018-12-05 trunk 66213) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
I don't know this problem is a problem of Racc or Ruby itself yet but I'll share this.
Here is a Ruby script that reproduce this case:
```ruby
require "racc/grammar"
hash = {}
[
[false, 0],
[:error, 1],
[:END, 2],
[:CLASS, 3],
[:RULE, 4],
[:"<", 5],
[:SYMBOL, 6],
[:":", 7],
[:CONV, 8],
].each do |value, ident|
sym = Racc::Sym.new(value, false)
sym.ident = ident
hash[sym] = ident
end
p hash
```
It outputs the following:
```text
{error=>1, END=>2, CLASS=>3, RULE=>4, <=>5, SYMBOL=>6, :=>7, CONV=>8}
```
It doesn't have an entry for `[false, 0]`.
If we reduce the last entry (`[:CONV, 8]`), we can see the entry for `[false, 0]`:
```ruby
require "racc/grammar"
hash = {}
[
[false, 0],
[:error, 1],
[:END, 2],
[:CLASS, 3],
[:RULE, 4],
[:"<", 5],
[:SYMBOL, 6],
[:":", 7],
].each do |value, ident|
sym = Racc::Sym.new(value, false)
sym.ident = ident
hash[sym] = ident
end
p hash
```
```text
{$end=>0, error=>1, END=>2, CLASS=>3, RULE=>4, <=>5, SYMBOL=>6, :=>7}
```
(`$end=>0` is the entry for `[false, 0]`.)
This is occurred since r65454.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-07 9:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <redmine.issue-15389.20181207042515@ruby-lang.org>
2018-12-07 4:25 ` [ruby-core:90356] [Ruby trunk Bug#15389] 8 elements or more larger Hash doesn't show an entry kou
2018-12-07 9:30 ` [ruby-core:90362] [Ruby trunk Bug#15389] 9 " hanmac
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).