Project

General

Profile

Actions

Backport #8188

closed

Wrong warning about __attached__

Added by marcandre (Marc-Andre Lafortune) almost 11 years ago. Updated almost 11 years ago.

Status:
Closed
[ruby-core:<unknown>]

Description

ruby -w -e "ARGF.singleton_class.instance_eval{}"

=> warning: instance variable attached not initialized

Here's the test, but I'm not sure how to fix. Should rb_ivar_get(..., id_attached) replaced with rb_attr_get?

diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb
index 580d3e8..8e3bd8c 100644
--- a/test/ruby/test_eval.rb
+++ b/test/ruby/test_eval.rb
@@ -215,6 +215,12 @@ class TestEval < Test::Unit::TestCase
     end
   end
 
+  def test_instance_eval_on_argf_singleton_class
+    assert_warning('', '[ruby-core:xxx]') do
+      ARGF.singleton_class.instance_eval{}
+    end
+  end
+
   class Foo
     Bar = 2
   end
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0