Proc source location gives wrong result#5262
Conversation
|
there're some failures |
|
I opened up #5286 to capture issue and did a different fix. This fix did not really work because $1 was a Java long to save cmd argument stack. If you look at my commit you can see I added another block making a different $1. yacc is icky and tough to grok. kudos for the attempt though! |
|
The idea behind the PR was to use $-1 which I guessed it should be either Thx for taking a look! |
|
@jmalves yeah I apologize for not noticing the '-'. I think this is a difference of jay perhaps and a more modern LALR-yacc like bison. I believe your PR would work if it wasn't jay. |
Fixes pry/pry#1804 (JRuby 9.2.0.0 breaks `source_location` and therefore our test suite) JRuby 9.2.0.0 fails to fetch source code for procs because of the bug: jruby/jruby#5262 The problem is that source_location is reported at the end of the proc, instead of the beginning. The way I fix it is rather dumb (rewinding back and checking if it's complete expression) but it's isolated only to 9.2.0.0 and likely won't be needed when another JRuby is released. However, so far it's the latest release.
Fixes pry/pry#1804 (JRuby 9.2.0.0 breaks `source_location` and therefore our test suite) JRuby 9.2.0.0 fails to fetch source code for procs because of the bug: jruby/jruby#5262 The problem is that source_location is reported at the end of the proc, instead of the beginning. The way I fix it is rather dumb (rewinding back and checking if it's complete expression) but it's isolated only to 9.2.0.0 and likely won't be needed when another JRuby is released. However, so far it's the latest release.
Fixes pry/pry#1804 (JRuby 9.2.0.0 breaks `source_location` and therefore our test suite) JRuby 9.2.0.0 fails to fetch source code for procs because of the bug: jruby/jruby#5262 The problem is that source_location is reported at the end of the proc, instead of the beginning. The way I fix it is rather dumb (rewinding back and checking if it's complete expression) but it's isolated only to 9.2.0.0 and likely won't be needed when another JRuby is released. However, so far it's the latest release.
Fixes pry/pry#1804 (JRuby 9.2.0.0 breaks `source_location` and therefore our test suite) JRuby 9.2.0.0 fails to fetch source code for procs because of the bug: jruby/jruby#5262 The problem is that source_location is reported at the end of the proc, instead of the beginning. The way I fix it is rather dumb (rewinding back and checking if it's complete expression) but it's isolated only to 9.2.0.0 and likely won't be needed when another JRuby is released. However, so far it's the latest release.
Environment
Expected Behavior
On ruby 2.5.0 and jruby-9.1.17.0 the following script:
Prints:
2 == 2Actual Behavior
On jruby-9.2.0.0 it prints
2 == 5Investigation
I found this bug by noticing that
rspecwith line filters (e.g.rspec test_file.rb:20) was not working.I traced this back to ca25471
I am doubtful that the fix I proposed in this PR is adequate but anyway it was fun to look around this.
Tested with fast specs, mri's test_lambda and test_proc. No spec failures were added but also none were fixed :X