diff options
| author | Jean byroot Boussier <jean.boussier+github@shopify.com> | 2024-08-06 19:34:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-06 10:34:39 -0700 |
| commit | 65cca99b30c65d462aa67969e0f16f6e45db4705 (patch) | |
| tree | abe5a234af639d5a066c6a07f3db7929e59051df /test/ruby | |
| parent | f85c7deacc25738bd83ba182370c283ba82b61d4 (diff) | |
parse.y: const_decl_path don't replace destination node by a literal (#11314)
[Bug #20668]
The `dest` node is assumed to be a `CDECL`, so overwriting it with
a `LIT` cause a crash on the next iteration.
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_parse.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index c2f02ff809..341d63c38a 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -1475,6 +1475,21 @@ x = __ENCODING__ assert !obj.equal?(a) end + def test_shareable_constant_value_literal_const_refs + a = eval_separately("#{<<~"begin;"}\n#{<<~'end;'}") + begin; + # shareable_constant_value: literal + # [Bug #20668] + SOME_CONST = { + 'Object' => Object, + 'String' => String, + 'Array' => Array, + } + SOME_CONST + end; + assert_ractor_shareable(a) + end + def test_shareable_constant_value_nested a, b = eval_separately("#{<<~"begin;"}\n#{<<~'end;'}") begin; |
