ruby-changes:69035
From: Alan <ko1@a...>
Date: Thu, 21 Oct 2021 08:20:36 +0900 (JST)
Subject: [ruby-changes:69035] b69951cf55 (master): add a couple of getivar tests for symbols
https://git.ruby-lang.org/ruby.git/commit/?id=b69951cf55 From b69951cf55a3bbd50a4d6e84185ee0f687946530 Mon Sep 17 00:00:00 2001 From: Alan Wu <XrXr@u...> Date: Fri, 9 Apr 2021 19:08:23 -0400 Subject: add a couple of getivar tests for symbols --- bootstraptest/test_yjit.rb | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb index 858e3906d0..fcda5476ea 100644 --- a/bootstraptest/test_yjit.rb +++ b/bootstraptest/test_yjit.rb @@ -578,3 +578,40 @@ assert_equal '42', %q{ https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_yjit.rb#L578 run run } + +# getinstancevariable on Symbol +assert_equal '[nil, nil]', %q{ + # @foo to exercise the getinstancevariable instruction + public def get_foo + @foo + end + + dyn_sym = ("a" + "b").to_sym + sym = :static + + # compile get_foo + dyn_sym.get_foo + dyn_sym.get_foo + + [dyn_sym.get_foo, sym.get_foo] +} + +# attr_reader on Symbol +assert_equal '[nil, nil]', %q{ + class Symbol + attr_reader :foo + end + + public def get_foo + foo + end + + dyn_sym = ("a" + "b").to_sym + sym = :static + + # compile get_foo + dyn_sym.get_foo + dyn_sym.get_foo + + [dyn_sym.get_foo, sym.get_foo] +} -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/