Open lare96 opened 5 years ago
To test if the counter isn't being reset I'll make my own line counter that records the amount of lines of each successful evaluated script. Then I'll just subtract the getLineNumber value by my counter and if the result is the correct line number then there's the problem.
My original thought about why this function doesn't work has been ruled out. Not sure where to go from here
I think the underlying REPL tries to use the length of the header to compute offsets, but maybe something is different in scripted usage. You can supply -Xprint:parser
to see what is actually submitted for compilation. (Scripted.apply
takes settings.)
Scala version: 2.12.6 Java version: 8
I have a series of scripts that are evaluated with the Scala ScriptEngine like so
When an exception is thrown, the line number that it returns is inaccurate. For example, take this script
getLineNumber should return 21 but instead it returns 221. In this instance, you could subtract 200 to get the line number but normally the value is unpredictable (ranges between 150-300). Could this be because the line number counter isn't being reset after each script evaluation? If so, is this the intended behavior?