Support absolute path source locators #5111
Merged
+34
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I tried really hard to write a test for this, but I could not get it to work, even in our lit tests due to Mill sandboxing. I would like to revisit this at some point but I have spent too long on this at the moment.
Proof this works, try:
Output is:
Note the missing leading
/, because we were stripping it inSourceInfoFileResolver.scala.With publish local of this branch (
7.4.0+18-4e05e9fc-SNAPSHOT):It might be worth simplifying
/Users/koenig/work/chisel/tt/chisel-example.scalaat error report time as well since scala-cli may compile in/, but it actually runs in the users current working directory.Contributor Checklist
docs/src?Type of Improvement
Desired Merge Strategy
Release Notes
The default behavior of Scala-cli is to use a Bloop server running in the root directory for compilation. This results in absolute paths in for source locators at compile time, but our logic had assumed we always had relative paths and was manually stripping the leading forward slash in source locator paths. Instead, we strip the leading forward slash for relative paths by including it in the path prefix we remove, and then in error reporting we add support for paths that are already absolute.
Reviewer Checklist (only modified by reviewer)
3.6.x,5.x, or6.xdepending on impact, API modification or big change:7.0)?Enable auto-merge (squash)and clean up the commit message.Create a merge commit.