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

The compiler interface should expose sourcePositionMappers so that Scala 3 can render messages with the proper positions #1074

Open
smarter opened this issue Mar 15, 2022 · 2 comments

Comments

@smarter
Copy link
Contributor

smarter commented Mar 15, 2022

steps

See scala/scala3#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).

@smarter
Copy link
Contributor Author

smarter commented Mar 15, 2022

@adpi2 If you miss working on sbt ^ :).

@tototoshi
Copy link
Contributor

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.

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

No branches or pull requests

2 participants