summaryrefslogtreecommitdiff
path: root/test/ruby/namespace/instance_variables.rb
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2025-06-12 12:02:56 +0200
committerJean Boussier <[email protected]>2025-06-12 13:43:29 +0200
commit8b5ac5abf258270b32ef63a6acb4eb0d191f79d9 (patch)
tree1a189584be652b2125e8d40aff97ee316860e45e /test/ruby/namespace/instance_variables.rb
parent81209719321f9cded2c4bdf50203f5ef34e3db7e (diff)
Fix class instance variable inside namespaces
Now that classes fields are delegated to an object with its own shape_id, we no longer need to mark all classes as TOO_COMPLEX.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13595
Diffstat (limited to 'test/ruby/namespace/instance_variables.rb')
-rw-r--r--test/ruby/namespace/instance_variables.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/namespace/instance_variables.rb b/test/ruby/namespace/instance_variables.rb
new file mode 100644
index 0000000000..1562ad5d45
--- /dev/null
+++ b/test/ruby/namespace/instance_variables.rb
@@ -0,0 +1,21 @@
+class String
+ class << self
+ attr_reader :str_ivar1
+
+ def str_ivar2
+ @str_ivar2
+ end
+ end
+
+ @str_ivar1 = 111
+ @str_ivar2 = 222
+end
+
+class StringDelegator < BasicObject
+private
+ def method_missing(...)
+ ::String.public_send(...)
+ end
+end
+
+StringDelegatorObj = StringDelegator.new