Forum: Ruby-core [ruby-trunk - Bug #7408][Open] Assigned but unused warning cancelled by symbol

Posted by agrimm (Andrew Grimm) (Guest)
on 2012-11-20 10:01
(Received via mailing list)
Issue #7408 has been reported by agrimm (Andrew Grimm).

----------------------------------------
Bug #7408: Assigned but unused warning cancelled by symbol
https://bugs.ruby-lang.org/issues/7408

Author: agrimm (Andrew Grimm)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: ruby 2.0.0dev (2012-11-18) [x86_64-darwin10.8.0]


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
Posted by mame (Yusuke Endoh) (Guest)
on 2012-11-24 10:01
(Received via mailing list)
Issue #7408 has been updated by mame (Yusuke Endoh).

Status changed from Open to Assigned
Assignee set to nobu (Nobuyoshi Nakada)
Target version set to 2.0.0


----------------------------------------
Bug #7408: Assigned but unused warning cancelled by symbol
https://bugs.ruby-lang.org/issues/7408#change-33802

Author: agrimm (Andrew Grimm)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category:
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-11-18) [x86_64-darwin10.8.0]


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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.