Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
VladRassokhin opened this Issue · 2 comments

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

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

@enebo
Owner

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

@enebo enebo closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.