-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Labels
Milestone
Description
Environment
JRuby 9k versions through 9.1.
Expected Behavior
Ideally none of the standard library sources should produce warnings in verbose mode.
Actual Behavior
Our date/format.rb, created by @eregon, produces the following errors when loaded in verbose mode:
/Users/headius/projects/jruby/lib/ruby/stdlib/date/format.rb:960: warning: named capture conflicts a local variable - year
/Users/headius/projects/jruby/lib/ruby/stdlib/date/format.rb:960: warning: named capture conflicts a local variable - mon
/Users/headius/projects/jruby/lib/ruby/stdlib/date/format.rb:960: warning: named capture conflicts a local variable - mday
/Users/headius/projects/jruby/lib/ruby/stdlib/date/format.rb:960: warning: named capture conflicts a local variable - yday
/Users/headius/projects/jruby/lib/ruby/stdlib/date/format.rb:960: warning: named capture conflicts a local variable - cwyear
/Users/headius/projects/jruby/lib/ruby/stdlib/date/format.rb:960: warning: named capture conflicts a local variable - cweek
/Users/headius/projects/jruby/lib/ruby/stdlib/date/format.rb:960: warning: named capture conflicts a local variable - cwday
/Users/headius/projects/jruby/lib/ruby/stdlib/date/format.rb:960: warning: named capture conflicts a local variable - hour
/Users/headius/projects/jruby/lib/ruby/stdlib/date/format.rb:960: warning: named capture conflicts a local variable - min
/Users/headius/projects/jruby/lib/ruby/stdlib/date/format.rb:960: warning: named capture conflicts a local variable - sec
/Users/headius/projects/jruby/lib/ruby/stdlib/date/format.rb:960: warning: named capture conflicts a local variable - sec_fraction
/Users/headius/projects/jruby/lib/ruby/stdlib/date/format.rb:960: warning: named capture conflicts a local variable - zone
/Users/headius/projects/jruby/lib/ruby/stdlib/date/format.rb:1005: warning: named capture conflicts a local variable - hour
/Users/headius/projects/jruby/lib/ruby/stdlib/date/format.rb:1005: warning: named capture conflicts a local variable - min
/Users/headius/projects/jruby/lib/ruby/stdlib/date/format.rb:1005: warning: named capture conflicts a local variable - sec
/Users/headius/projects/jruby/lib/ruby/stdlib/date/format.rb:1005: warning: named capture conflicts a local variable - sec_fraction
/Users/headius/projects/jruby/lib/ruby/stdlib/date/format.rb:1005: warning: named capture conflicts a local variable - zone
These errors are Ruby's attempt to warn us that we're using the same local variable name as a named capture. I do not believe this warning is useful, and I have filed https://bugs.ruby-lang.org/issues/12359 to have it removed from Ruby. If that bug is not accepted, we'll need to change this code to eliminate the warnings.
Reactions are currently unavailable