aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-13 13:34:26 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-13 13:34:26 +0000
commit37b04894f20a5d3701309a2055bfa03b9d760090 (patch)
tree80fa3381eeb311d3f15bec0b72352c903f85772b /test/ruby
parentca7a4aea1534679bba944796c31489cc65bf910f (diff)
downloadruby-37b04894f20a5d3701309a2055bfa03b9d760090.tar.gz
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
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_parse.rb3
1 files changed, 3 insertions, 0 deletions
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