Actions
Bug #20788
closedPrism issues unused variable warnings for negative line numbers
Description
parse.y does not issue unused variable warnings for negative line numbers. However, prism does issue such warnings.
Example code:
Object.class_eval(<<END, nil, -2)
def a(locals)
foo = locals[:foo]
2
end
END
Output:
$ run_ruby -v --parser=prism --disable-gems t/t82.rb
ruby 3.4.0dev (2024-10-08T22:14:44Z master 3fc1495c30) +PRISM [x86_64-openbsd7.6]
(eval at t/t82.rb:1):-1: warning: assigned but unused variable - foo
$ run_ruby -v --parser=parse.y --disable-gems t/t82.rb
ruby 3.4.0dev (2024-10-08T22:14:44Z master 3fc1495c30) [x86_64-openbsd7.6]
This results in spurious verbose-mode warnings in applications using tilt, the template library used by most non-Rails web frameworks (Sinatra, Roda, Hanami, Cuba, Camping, etc.).
Actions
Like0
Like0