-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
Use full file path for parse error messages and compiler metadata #1233
Conversation
@alexarchambault looks like the only things failing are some Scala3 tests. I think I need to modify this Scala3 code: The same way as the corresponding Scala2 code: I'm not familiar with the Scala3 APIs, do you have any idea how we might accomplish that? In Scala2, we could pass in separate |
@alexarchambault Also, it seems the |
@alexarchambault have you had a chance to look at this? If you're busy I'll probably just disable the respective Scala3 tests for now and move forward with the fix for Scala2 |
The sourcecode problem appears to be due to having the scala2 version of sourcecode on the scala3 ammonite test classpath |
Fixes #646
Fixes #493
Previously we constructed a
new io.VirtualFile
with an identical name and path, both short, to ensure stack traces included only the file name. The correct thing to do is to provide separate names and paths, so stack traces can use the file name while compiler errors can use the full file path. This is done differently in Scala2 and Scala3 due to differences in the compiler APIs, but the end result is the sameThis makes the parse/compile errors line up more with how the normal Scala compiler reports them, and fixes
sourcecode.File
to properly report the full path of the script file.Updated the existing LineNumberTests to verify the fixed behavior, and added a new
sourceCodeMetadata.sc
test case to verify the fix applies to thesourcecode.*
macros. For nowsourcecode.*
macros do not work in the REPL or scripts in Scala3, but that is an unrelated problem we can deal with laterReview by @alexarchambault and @anatoliykmetyuk