From 37b04894f20a5d3701309a2055bfa03b9d760090 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 13 Aug 2017 13:34:26 +0000 Subject: parse.y: set used flag in gettable * parse.y (dvar_defined_ref, dvar_defined): rename macros. only gettable uses the former. assignable should not set LVAR_USED flag. * parse.y (gettable_gen): set used flag on local/dynamic variables instead of setting in lexer. [ruby-core:82368] [Bug #13809] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_parse.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index cc38214fd6..819fc7df95 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -881,8 +881,11 @@ x = __ENCODING__ def test_unused_variable o = Object.new assert_warning(/assigned but unused variable/) {o.instance_eval("def foo; a=1; nil; end")} + assert_warning(/assigned but unused variable/) {o.instance_eval("def bar; a=1; a(); end")} a = "\u{3042}" assert_warning(/#{a}/) {o.instance_eval("def foo; #{a}=1; nil; end")} + o = Object.new + assert_warning(/assigned but unused variable/) {o.instance_eval("def foo; tap {a=1; a()}; end")} end def test_named_capture_conflict -- cgit v1.2.3