Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Hash#compare_by_identity does not work with string keys #2615

Open
takaram opened this issue Nov 25, 2023 · 0 comments
Open

Bug: Hash#compare_by_identity does not work with string keys #2615

takaram opened this issue Nov 25, 2023 · 0 comments
Labels

Comments

@takaram
Copy link
Member

takaram commented Nov 25, 2023

Describe the bug
Hash objects don't respect the object id of string keys even when compare_by_identity enabled.

Opal version: 1.8.2

To Reproduce
Sample code:

str1 = "foo"
str2 = str1.dup
hash = {}.compare_by_identity
hash[str1] = 1

p [str1.object_id, str2.object_id]
p [hash[str1], hash[str2]]
$ bin/opal -v test.rb
Opal v2.0.0dev
[58, 60]
[1, 1]
$ ruby -v test.rb
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
[60, 80]
[1, nil]
@takaram takaram added the bug label Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant