Project

General

Profile

Actions

Bug #15389

closed

9 elements or more larger Hash doesn't show an entry

Added by kou (Kouhei Sutou) over 5 years ago. Updated over 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.6.0dev (2018-12-05 trunk 66213) [x86_64-linux]
[ruby-core:90356]

Description

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:

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:

{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]:

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
{$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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0