zinc
zinc copied to clipboard
The compiler interface should expose sourcePositionMappers so that Scala 3 can render messages with the proper positions
steps
See https://github.com/lampepfl/dotty/issues/14691
problem
On the compiler side, we implement CompilerInterface2 in https://github.com/lampepfl/dotty/blob/main/sbt-bridge/src/dotty/tools/xsbt/CompilerBridge.java, but as far as I know this interface doesn't expose the sourcePositionMappers.
expectation
I guess we need a CompilerInterface3 with an extra argument.
notes
xsbti.compile.CompileOptions has a field sourcePositionMapper, but this class only appears in xsbti.compile.Inputs which itself only appears in xsbti.compile.IncrementalCompiler which as far as I can tell is unrelated to CompilerInterface2 (in fact I have no idea who is supposed to implement IncrementalCompiler).
@adpi2 If you miss working on sbt ^ :).
I had a chance to talk with @eed3si9n today. He was wondering if this issue should be resolved on the sbt side. I was also thinking about the possibility.
I have an idea. Now the position mapping using sourcePositionMappers is done by ManagedLoggedReporter in sbt. This class is provided by sbt's compilerReporter key.
If I change sbt-twirl to use compilerReporter instead of sourcePositionMapper, I think it would be possible to solve the original problem.
Unfortunately, the compilerReporter key is marked as private and cannot be replaced by the user. I don't know the reason for this and will have to look into it.