Project

General

Profile

Actions

Bug #20433

closed

Hash.inspect for some hash returns syntax invalid representation

Added by tompng (tomoya ishida) 7 months ago. Updated about 2 months ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:117564]

Description

For these hashes, Hash.inspect returns a syntax invalid representation:

{ :a! => 1 } # {:a!=>1}
{ :a? => 1 } # {:a?=>1}
{ :* => 1 }  # {:*=>1}
{ :== => 1 } # {:===>1}
{ :< => 1 }  # {:<=>1}

eval(hash.inspect) will raise SyntaxError.
Although inspect does not guarantee that the result can be eval-ed, it'd be confusing for these few cases.

Maybe related to https://bugs.ruby-lang.org/issues/20235


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #20857: Ruby 3.4 seems to have backwards compatibility issues more than its predecessorsClosedmatz (Yukihiro Matsumoto)Actions
Actions

Also available in: Atom PDF

Like0
Like1Like0Like0Like0Like0Like0Like0Like0Like0Like1Like0Like0Like0Like0Like1Like0