diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2023-02-16 17:41:52 -0500 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2023-02-16 18:50:42 -0500 |
commit | a4b7ec12298c78392797e5ba7704076550e4f100 (patch) | |
tree | 81f3be02dbb02967e89b7805e3b4ca0d4d041092 /test | |
parent | c178926fbe879045fa711444a1fd9e906af23e3b (diff) |
YJIT: Fix false assumption that String#+@ => ::String
Could return a subclass.
[Bug #19444]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7328
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_yjit.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb index 2428a401cf..ce51dd83f7 100644 --- a/test/ruby/test_yjit.rb +++ b/test/ruby/test_yjit.rb @@ -1119,6 +1119,23 @@ class TestYJIT < Test::Unit::TestCase RUBY end + def test_str_uplus_subclass + assert_compiles(<<~RUBY, frozen_string_literal: true, result: :subclass) + class S < String + def encoding + :subclass + end + end + + def test(str) + (+str).encoding + end + + test "" + test S.new + RUBY + end + private def code_gc_helpers |