Project

General

Profile

Actions

Bug #22469

open

parse.y hash key does not warn on -0.0

Bug #22469: parse.y hash key does not warn on -0.0

Added by kddnewton (Kevin Newton) 29 days ago. Updated 2 days ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:127225]

Description

When generating warnings for duplicate keys (hash keys or case-when clauses) parse.y misses warning on -0.0 and 0.0 because it doesn't normalize it like a Ruby hash does.

{ 0.0 => 1, -0.0 => 1 }

^-- should warn

Updated by matz (Yukihiro Matsumoto) 2 days ago Actions #1 [ruby-core:127614]

I agree this is a bug. 0.0 and -0.0 are the same key in a Hash at runtime, so the parser should warn about the duplicate, both for hash literals and for when clauses.

The priority is low, though. It only affects a warning, so there is no hurry, and I don't think it needs to be backported.

Matz.

Actions

Also available in: PDF Atom