Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

Projects
None yet
3 participants
@VladRassokhin
Copy link

commented Jan 20, 2014

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

This comment has been minimized.

Copy link
Contributor

commented Jan 27, 2014

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

@enebo

This comment has been minimized.

Copy link
Member

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
You can’t perform that action at this time.