-
Notifications
You must be signed in to change notification settings - Fork 5
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
Make error reporting match that of SBT's #53
Conversation
def adjustStringPath(path: String) = SandboxUtil.getSandboxPath(workDir, Paths.get(path)).toString | ||
|
||
options.flatMap { | ||
case s"-P:semanticdb:targetroot:$path" => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there other other common compiler options that we know of which need a specific path?
This is a tricky issue because in theory there are infinite options which could do so. Even better yet they get specified by the user.
I suppose it's probably just not work thinking about for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a tricky issue because in theory there are infinite options which could do so. Even better yet they get specified by the user.
I thought of this when I made this change and did feel slimy modifying compiler options like this, but I think it's better to modify compiler options than pass SemanticDB options separately. My reasoning is that because there are likely many compiler options that reference paths and some of those compiler options may be used outside of this ruleset (by those defining Scala libraries, binaries, tests, etc..), it's much less confusing to intercept compiler options than direct users to use another set of options instead.
I could go through every compiler option that references file paths, but that list is probably endless and I figured we can expand this list as necessary.
src/main/scala/higherkindness/rules_scala/workers/common/LoggedReporter.scala
Show resolved
Hide resolved
src/main/scala/higherkindness/rules_scala/workers/zinc/compile/ZincRunner.scala
Show resolved
Hide resolved
Not only does ProblemStringFormats format problems (compilation messages) slightly differently, but it uses `xsbti.Position#pointer` rather than `xsbti.Position#offset` as the column number. Prior to v1.10.1 of Zinc, `sbt.internal.inc.javac.JavaPosition`, a concrete implementation of `Position`, set `pointer` to `None` unconditionally, meaning that `ProblemStringFormats` didn't have access to the line number. To fix this, I upgraded our version of Zinc to v1.10.1 from v1.10.0.
8ea3a21
to
b1f7447
Compare
This PR fixes the following discrepancy with our compiler error reporting and SBT's:
Ours:
Using SBT or
scalac
:The
[Error]
line prefix is added by us, but the detailed position information is missing.Additionally, this PR fixes the test failures on
lucid-master
.