ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:119485] [Ruby master Bug#20788] Prism issues unused variable warnings for negative line numbers
@ 2024-10-08 23:55 jeremyevans0 (Jeremy Evans) via ruby-core
  0 siblings, 0 replies; only message in thread
From: jeremyevans0 (Jeremy Evans) via ruby-core @ 2024-10-08 23:55 UTC (permalink / raw)
  To: ruby-core; +Cc: jeremyevans0 (Jeremy Evans)

Issue #20788 has been reported by jeremyevans0 (Jeremy Evans).

----------------------------------------
Bug #20788: Prism issues unused variable warnings for negative line numbers
https://bugs.ruby-lang.org/issues/20788

* Author: jeremyevans0 (Jeremy Evans)
* Status: Open
* Assignee: kddnewton (Kevin Newton)
* Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED
----------------------------------------
parse.y does not issue unused variable warnings for negative line numbers. However, prism does issue such warnings.

Example code:

```ruby
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.).



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-10-08 23:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-08 23:55 [ruby-core:119485] [Ruby master Bug#20788] Prism issues unused variable warnings for negative line numbers jeremyevans0 (Jeremy Evans) via ruby-core

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).