Issue #15188 has been reported by cout (Paul Brannan).

----------------------------------------
Bug #15188: Incorrect warning "assigned but unused variable" when using ripper with $VERBOSE = true
https://bugs.ruby-lang.org/issues/15188

* Author: cout (Paul Brannan)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
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.




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>