Project

General

Profile

Actions

Bug #15188

closed

Incorrect warning "assigned but unused variable" when using ripper with $VERBOSE = true

Added by cout (Paul Brannan) about 6 years ago. Updated almost 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
[ruby-core:89236]

Description

The following code:

require 'ripper'

class Parser < Ripper
  def warn(fmt, *args)
    puts "#{filename}:#{lineno} - #{fmt % args}"
  end
end

if __FILE__ == $0 then
  $VERBOSE = true

  s = 'foo = 42; p foo'
  parser = Parser.new(s)
  parser.parse
end

produces this warning:

(ripper):1 - assigned but unused variable - foo

but clearly foo is not unused.


Files

ripper-assign-unused-15188.patch (1004 Bytes) ripper-assign-unused-15188.patch jeremyevans0 (Jeremy Evans), 08/27/2019 07:00 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0