Skip to content
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

Fix #930: Report original problems in SourceInfos #931

Merged
merged 1 commit into from
Oct 8, 2020

Conversation

adpi2
Copy link
Member

@adpi2 adpi2 commented Oct 7, 2020

Fixes #930

LoggedReporter.allProblems return original problems so that the AnalysisCallback can link each position to the corresponding VirtualFile

@adpi2
Copy link
Member Author

adpi2 commented Oct 7, 2020

Should I do something to validate this against sbt?

@eed3si9n
Copy link
Member

eed3si9n commented Oct 7, 2020

@adpi2 Thanks for the fix.

@rtimush wrote in sbt/sbt#5892 (comment):

So, apparently what happens is that sourcePositionMapper converts virtualizes path into the real one, then the real path is used to build a map of compile problems in Incremental#problem but the lookup uses the virtualized path in Incremental#addProductsAndDeps.

It would be good if you could confirm that this patch would address sbt/sbt#5892 by locally publishing zinc. I often use the following to bind SNAPSHOT Zinc against sbt to locally check:

sbt -Dsbtzinc.path=../zinc

@rtimush
Copy link

rtimush commented Oct 7, 2020

I checked sbt/sbt#5892 with this PR and my test (sbt/sbt@develop...rtimush:warnings-test) passed.

@eed3si9n eed3si9n merged commit 5a1a9d2 into sbt:develop Oct 8, 2020
mkurz added a commit to mkurz/playframework that referenced this pull request Mar 9, 2021
… mapping is only done for logging

Starting with sbt 1.4.1, when a compilation error occurs, the Position of a Problem (which is contained within the Incomplete) will no longer refer
to the mapped source file (e.g. until sbt 1.4.0 the Position would refer to "conf/routes" when a compilation error actually happened
in "target/scala-2.13/routes/main/router/Routes.scala").
That's caused by sbt/zinc#931: The file causing the compilation error is not transformed via the sourcePositionMappers config
anymore before adding it to "allProblems", the field that eventually gets used by the Incomplete. (The transformation still takes place to show
the mapped source file in the logs) Play however needs to know the mapped source file to display it in it's error pages for a nice dev experience.
So the solution is that Play itself will try to transform the source file to the mapped file by running it "through" sourcePositionMappers:
mkurz added a commit to mkurz/playframework that referenced this pull request Mar 10, 2021
… mapping is only done for logging

Starting with sbt 1.4.1, when a compilation error occurs, the Position of a Problem (which is contained within the Incomplete) will no longer refer
to the mapped source file (e.g. until sbt 1.4.0 the Position would refer to "conf/routes" when a compilation error actually happened
in "target/scala-2.13/routes/main/router/Routes.scala").
That's caused by sbt/zinc#931: The file causing the compilation error is not transformed via the sourcePositionMappers config
anymore before adding it to "allProblems", the field that eventually gets used by the Incomplete. (The transformation still takes place to show
the mapped source file in the logs) Play however needs to know the mapped source file to display it in it's error pages for a nice dev experience.
So the solution is that Play itself will try to transform the source file to the mapped file by running it "through" sourcePositionMappers:
mkurz added a commit to mkurz/playframework that referenced this pull request Mar 10, 2021
… mapping is only done for logging

Starting with sbt 1.4.1, when a compilation error occurs, the Position of a Problem (which is contained within the Incomplete) will no longer refer
to the mapped source file (e.g. until sbt 1.4.0 the Position would refer to "conf/routes" when a compilation error actually happened
in "target/scala-2.13/routes/main/router/Routes.scala").
That's caused by sbt/zinc#931: The file causing the compilation error is not transformed via the sourcePositionMappers config
anymore before adding it to "allProblems", the field that eventually gets used by the Incomplete. (The transformation still takes place to show
the mapped source file in the logs) Play however needs to know the mapped source file to display it in it's error pages for a nice dev experience.
So the solution is that Play itself will try to transform the source file to the mapped file by running it "through" sourcePositionMappers:
mkurz added a commit to mkurz/playframework that referenced this pull request Mar 10, 2021
… mapping is only done for logging

Starting with sbt 1.4.1, when a compilation error occurs, the Position of a Problem (which is contained within the Incomplete) will no longer refer
to the mapped source file (e.g. until sbt 1.4.0 the Position would refer to "conf/routes" when a compilation error actually happened
in "target/scala-2.13/routes/main/router/Routes.scala").
That's caused by sbt/zinc#931: The file causing the compilation error is not transformed via the sourcePositionMappers config
anymore before adding it to "allProblems", the field that eventually gets used by the Incomplete. (The transformation still takes place to show
the mapped source file in the logs) Play however needs to know the mapped source file to display it in it's error pages for a nice dev experience.
So the solution is that Play itself will try to transform the source file to the mapped file by running it "through" sourcePositionMappers:
mkurz added a commit to mkurz/playframework that referenced this pull request Mar 10, 2021
… mapping is only done for logging

Starting with sbt 1.4.1, when a compilation error occurs, the Position of a Problem (which is contained within the Incomplete) will no longer refer
to the mapped source file (e.g. until sbt 1.4.0 the Position would refer to "conf/routes" when a compilation error actually happened
in "target/scala-2.13/routes/main/router/Routes.scala").
That's caused by sbt/zinc#931: The file causing the compilation error is not transformed via the sourcePositionMappers config
anymore before adding it to "allProblems", the field that eventually gets used by the Incomplete. (The transformation still takes place to show
the mapped source file in the logs) Play however needs to know the mapped source file to display it in it's error pages for a nice dev experience.
So the solution is that Play itself will try to transform the source file to the mapped file by running it "through" sourcePositionMappers:
mkurz added a commit to mkurz/playframework that referenced this pull request Mar 10, 2021
… mapping is only done for logging

Starting with sbt 1.4.1, when a compilation error occurs, the Position of a Problem (which is contained within the Incomplete) will no longer refer
to the mapped source file (e.g. until sbt 1.4.0 the Position would refer to "conf/routes" when a compilation error actually happened
in "target/scala-2.13/routes/main/router/Routes.scala").
That's caused by sbt/zinc#931: The file causing the compilation error is not transformed via the sourcePositionMappers config
anymore before adding it to "allProblems", the field that eventually gets used by the Incomplete. (The transformation still takes place to show
the mapped source file in the logs) Play however needs to know the mapped source file to display it in it's error pages for a nice dev experience.
So the solution is that Play itself will try to transform the source file to the mapped file by running it "through" sourcePositionMappers:
mkurz added a commit to mkurz/playframework that referenced this pull request Mar 10, 2021
… mapping is only done for logging

Starting with sbt 1.4.1, when a compilation error occurs, the Position of a Problem (which is contained within the Incomplete) will no longer refer
to the mapped source file (e.g. until sbt 1.4.0 the Position would refer to "conf/routes" when a compilation error actually happened
in "target/scala-2.13/routes/main/router/Routes.scala").
That's caused by sbt/zinc#931: The file causing the compilation error is not transformed via the sourcePositionMappers config
anymore before adding it to "allProblems", the field that eventually gets used by the Incomplete. (The transformation still takes place to show
the mapped source file in the logs) Play however needs to know the mapped source file to display it in it's error pages for a nice dev experience.
So the solution is that Play itself will try to transform the source file to the mapped file by running it "through" sourcePositionMappers:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reported problems are always empty on VirtualFiles
3 participants