Skip to content

Uninline diagnostic position before passing it into xsbti.Reporter #12425

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

Merged
merged 1 commit into from
May 12, 2021

Conversation

dos65
Copy link
Contributor

@dos65 dos65 commented May 11, 2021

Originally was found in scalameta/metals#2769 .
Without this fix, metals receives diagnostic that points into the wrong source file

@nicolasstucki
Copy link
Contributor

Can we add a test in this project or is that something that needs to be added in metals?

@soronpo
Copy link
Contributor

soronpo commented May 12, 2021

Actually, this not just affects metals, and I have a compiler test-case. I'll try to minimize it further.
I already tested and this PR fixes it.

@dos65
Copy link
Contributor Author

dos65 commented May 12, 2021

@nicolasstucki
As @soronpo said it affects not only metals but also bloop (+ probably sbt-bsp).

Is there any reason why the position here shouldn't be nonInlined?
For example, ConsoleReporter does the same thing.

@soronpo
Copy link
Contributor

soronpo commented May 12, 2021

(the examples assumes the latest update to the summonInline implementation)
Minimized:

trait Foo
inline def foo : Any =
  compiletime.summonInline[Foo]
val f = foo

Without the fix:
image

With the fix:

4 |val f = foo
  |        ^^^
  |        no implicit argument of type Foo was found
  | This location contains code that was inlined from Main.scala:3

@nicolasstucki
Copy link
Contributor

Is there any reason why the position here shouldn't be nonInlined?

Not that I see right now.

The test would be good just to avoid regressions.

@dos65
Copy link
Contributor Author

dos65 commented May 12, 2021

@nicolasstucki Oh. Yes, it's easy to cover by test in metals. Will do that.

@soronpo
Copy link
Contributor

soronpo commented May 12, 2021

Actually, I was mistaken. My example error is shown in IntelliJ, so yeah bloop is affected but I have not been able to replicate it just as a compiler error.

@nicolasstucki
Copy link
Contributor

Then let's add the test to metals.

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.

3 participants