Project

General

Profile

Backport #7408

Assigned but unused warning cancelled by symbol

Added by agrimm (Andrew Grimm) over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:49659]

Description

If there is a symbol with the same name as an unused local variable, there is no "assigned but unused variable"

=begin
# no_warning.rb
def no_warning
foo = 1
{:foo => 1}
end

def has_warning
  foo = 1
  {:bar => 1}
end

$ ruby -v
ruby 2.0.0dev (2012-11-18) [x86_64-darwin10.8.0]
$ ruby -w no_warning.rb
no_warning.rb:8: warning: assigned but unused variable - foo

=end


Files

no_warning.rb (105 Bytes) no_warning.rb agrimm (Andrew Grimm), 11/20/2012 06:00 PM

Also available in: Atom PDF