diff options
| author | Jenny Shen <jenny.shen@shopify.com> | 2024-02-01 14:56:26 -0500 |
|---|---|---|
| committer | Kevin Newton <kddnewton@gmail.com> | 2024-02-01 15:52:33 -0500 |
| commit | 4fbdbde0887d038c679b9e0369234d1061441232 (patch) | |
| tree | fd72ac865ca77194b8f7deaf601d21ffbbb8d3f9 /test/ruby | |
| parent | 332d2c92d8fd7827690e9be8ab76e4f999713b51 (diff) | |
[PRISM] dedup hash string keys
Fixes ruby/prism#2321
Co-authored-by: Adrianna Chang <adrianna.chang@shopify.com>
Co-authored-by: Peter Zhu <peter@peterzhu.ca>
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_compile_prism.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index 69cc6980b0..c80feb66ee 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -2052,6 +2052,18 @@ end # -*- coding: us-ascii -*- "\xff".freeze.encoding RUBY + + # Test opt_aref_with instruction when calling [] with a string + assert_prism_eval(<<~RUBY) + ObjectSpace.count_objects + + h = {"abc" => 1} + before = ObjectSpace.count_objects[:T_STRING] + 5.times{ h["abc"] } + after = ObjectSpace.count_objects[:T_STRING] + + before == after + RUBY end def test_CallAndWriteNode |
