-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
sourcePositionMapper
of sbt doesn't work with DelegatingReporter
of Dotty
#14691
Comments
I don't feel able to tackle this myself, but I do hope that a volunteer can be found, since it would help Play get onto Scala 3. |
It seems that the API provided by zinc in xsbti doesn't expose the sourcePositionMappers stuff, so this will likely require some work on zinc. Alternatively someone could come up with a build-independent way to express source maps (e.g., an annotation that would be interpreted by the compiler). Either way this is likely to be a lot of work that will require significant effort from Someone™. |
A temporary hack could be to turn off the use of |
I've opened sbt/zinc#1074. |
I'd be happy to assist anyone who wants to work on Zinc, if Zinc needs updates. |
I'm always happy to learn new things and help out, maybe we can find sometime to collaborate together on this :) |
IMHO this issue is not relevant anymore. Based on the initial comment I created a reproducer and starting with sbt 1.7.0 the output is correct also when using Scala 3.
@tototoshi @brbrown25 @smarter @eed3si9n @SethTisue Can you confirm? |
I'll give it a try once I get a moment |
The problem with Twirl and sbt have been resolved by the PR I submitted to sbt/zinc. If no other issues have been found, I believe this PR can be closed. |
Compiler version
3.1.1
Minimized code
project/plugins.sbt
build.sbt
src/main/twirl/error.scala.html
Output
Expectation
When we write a template (.scala.html) for playframework/twirl, The template will be converted to a .scala file and compiled as a Scala object. If errors are found, Twirl shows them as template errors using
sourcePositionMappers
of sbt.https://github.com/playframework/twirl/blob/2c064e741ff8771c68e6397518fc05cb16d61c67/sbt-twirl/src/main/scala/play/twirl/sbt/SbtTwirl.scala#L79
This works with Scala2 but doesn't work with Scala3. We see error messages directly from Dotty in Scala3.
I think this is because
DelegatingReporter
of Dotty passes arendered
parameter toxsbti.Reporter
.https://github.com/lampepfl/dotty/blob/d2ebd75a2e63e3dd885e7bad94472931d0bae296/sbt-bridge/src/dotty/tools/xsbt/DelegatingReporter.java#L47
If the
rendered
parameter is passed, sbt will display the contents of therendered
parameter, and information other than therendered
parameter is ignored. The error information translated bysourcePositionMappers
in sbt'sManagedLoggedReporter
will also not be displayed.If I modify the
DelegatingReporter
so that therendered
parameter is not passed to sbt, it is possible to display the same error message as when compiling with Scala2. However, the message stored in therendered
parameter is from Dotty and contains more detailed error messages, so I feel a bit uncomfortable making it completely invisible. What do you think?The text was updated successfully, but these errors were encountered: