mirror of
https://github.com/ruby/ruby.git
synced 2025-08-27 15:06:10 +02:00
parse.y: remove "shadowing outer local variable" warning
You can now write the following without warning. user = User.all.find {|user| cond(user) } Fixes [Feature #12490]. A patch from Soutaro Matsumoto <matsumoto@soutaro.com>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b171d92046
commit
c9d720b873
6 changed files with 17 additions and 26 deletions
|
@ -911,10 +911,8 @@ x = __ENCODING__
|
|||
assert_equal(expected, actual, bug5614)
|
||||
end
|
||||
|
||||
def test_shadowing_variable
|
||||
assert_warning(/shadowing outer local variable/) {eval("a=1; tap {|a|}")}
|
||||
a = "\u{3042}"
|
||||
assert_warning(/#{a}/o) {eval("#{a}=1; tap {|#{a}|}")}
|
||||
def test_no_shadowing_variable_warning
|
||||
assert_no_warning(/shadowing outer local variable/) {eval("a=1; tap {|a|}")}
|
||||
end
|
||||
|
||||
def test_unused_variable
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue