Skip to content

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Mar 4, 2020

In the previous version of the compiler bridge we were adding 1 here:

https://github.com/sbt/zinc/blob/fc58a39402ca7abfda17133a5b3a43de3344ca49/internal/compiler-bridge/src/main/scala/xsbt/DelegatingReporter.scala#L99

which means Zinc expects line numbers starting at 1, while in Dotty we provided it with ones starting at 0.
This wasn't an issue when using dotc and sbt, since dotc added 1 to show the correct line number and sbt most likely used the Dotty rendered message due to:
https://github.com/sbt/zinc/pull/699/files?diff=unified&w=1

This popped up when adding some test in Bloop: tgodzik/bloop#1

Let me know if we should fix it differently. This is needed for the work I am doing on the Metals/Dotty integration.

Copy link
Member

@dottybot dottybot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, and thank you for opening this PR! 🎉

All contributors have signed the CLA, thank you! ❤️

Have an awesome day! ☀️

assert(line.isPresent() == true)
assert(line.get() == 9)

// Assert disabled because we don't currently pass positions to sbt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that assert can be reenabled now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reenabled the assert.

}
public Optional<Integer> line() {
int line = pos.line();
int line = pos.line() + 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to do anything for columns? Either way a test would be welcome.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I've seen the columns are correct. I will add a test for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@tgodzik tgodzik requested a review from smarter March 4, 2020 15:41
@smarter smarter merged commit 0954a07 into scala:master Mar 4, 2020
@tgodzik tgodzik deleted the fix-off-by-one branch March 4, 2020 17:17
@tgodzik
Copy link
Contributor Author

tgodzik commented Mar 4, 2020

Thanks @smarter !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants