diff options
| author | Max Bernstein <rubybugs@bernsteinbear.com> | 2025-08-29 09:32:38 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-29 12:32:38 -0400 |
| commit | 7f4a6afab81c8e33fb4a6bbaceca96b6672dc7aa (patch) | |
| tree | 656f48844e5ea682f5c62e5c1bb7332c17e4fcaa /test/ruby/test_zjit.rb | |
| parent | df1334421f555a9d2ad9961d234eb3b88418b058 (diff) | |
ZJIT: Remove special case for defined?(method call) (#14401)
This was fixed in https://github.com/ruby/ruby/pull/14308
Thanks, Stan, for noticing.
Fixes https://github.com/Shopify/ruby/issues/703
Diffstat (limited to 'test/ruby/test_zjit.rb')
| -rw-r--r-- | test/ruby/test_zjit.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb index c11f7bfa9a..98f747c4d0 100644 --- a/test/ruby/test_zjit.rb +++ b/test/ruby/test_zjit.rb @@ -1355,6 +1355,29 @@ class TestZJIT < Test::Unit::TestCase }, insns: [:defined] end + def test_defined_method_raise + assert_compiles '[nil, nil, nil]', %q{ + class C + def assert_equal expected, actual + if expected != actual + raise "NO" + end + end + + def test_defined_method + assert_equal(nil, defined?("x".reverse(1).reverse)) + end + end + + c = C.new + result = [] + result << c.test_defined_method + result << c.test_defined_method + result << c.test_defined_method + result + } + end + def test_defined_yield assert_compiles "nil", "defined?(yield)" assert_compiles '[nil, nil, "yield"]', %q{ |
