Fix string value in hash literal being forced frozen

We should pass `false` for `hash_key` for value nodes. Credits to
`@kddnewton` for noticing and bisecting.
This commit is contained in:
Alan Wu 2024-02-20 16:45:59 -05:00
parent 5fb574ae4e
commit 2a6917b463
2 changed files with 6 additions and 1 deletions

View file

@ -184,6 +184,11 @@ class TestRubyLiteral < Test::Unit::TestCase
list.each { |str| assert_predicate str, :frozen? }
end
def test_string_in_hash_literal
hash = eval("# frozen-string-literal: false\n""{foo: 'foo'}")
assert_not_predicate(hash[:foo], :frozen?)
end
if defined?(RubyVM::InstructionSequence.compile_option) and
RubyVM::InstructionSequence.compile_option.key?(:debug_frozen_string_literal)
def test_debug_frozen_string