Incorrect line number reported in "already initialized constant" warining #1424

Closed
VladRassokhin opened this Issue Jan 20, 2014 · 2 comments

Projects

None yet

3 participants

@VladRassokhin

Given ruby file

MY_CONST = __LINE__
p MY_CONST
MY_CONST = __LINE__
p MY_CONST
MY_CONST = __LINE__
p MY_CONST

When run in ruby-2.0 (MRI) output is:

1
1.rb:3: warning: already initialized constant MY_CONST
1.rb:1: warning: previous definition of MY_CONST was here
3
1.rb:5: warning: already initialized constant MY_CONST
1.rb:3: warning: previous definition of MY_CONST was here
5

With JRuby (1.7.10 and older) got:

1
1.rb:4 warning: already initialized constant MY_CONST
3
1.rb:6 warning: already initialized constant MY_CONST
5 

As you can see JRuby reports wrong line number in warnings.

@eldritchideen
Contributor

I believe that this is the same issue that has been reported and fixed with this pull request. #1450

@enebo
Member
enebo commented Jan 27, 2014

The reported test case does indeed appear to be fixed by #1450. Resolving.

@enebo enebo closed this Jan 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment