scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.73k stars 1.04k forks source link

[SemanticDB] Symbol that name doesn't present in source shouldn't be registered as SymbolOccurrence #15142

Closed tanishiking closed 2 years ago

tanishiking commented 2 years ago

https://github.com/scalameta/metals/issues/3901

Compiler version

3.1.2

Minimized code

trait Stuff[A]:
  def `do`: A

given Stuff[String] with
  def `do`: String = "done"
end given

Output

generates the following Symbol Occurrence

Occurrences:
[0:6..0:11) <= _empty_/Stuff#
[0:12..0:13) <= _empty_/Stuff#[A]
[1:7..1:9) <= _empty_/Stuff#do().
[1:12..1:13) => _empty_/Stuff#[A]
[3:6..3:11) => _empty_/Stuff#
[3:12..3:18) => scala/Predef.String#
[4:7..4:9) <= _empty_/Main$package.given_Stuff_String.do().
[4:12..4:18) => scala/Predef.String#
[4:19..5:9) => _empty_/Main$package.given_Stuff_String.

but [4:19..5:9) => _empty_/Main$package.given_Stuff_String. doesn't present in source and it shouldn't be registered as SymbolOccurrence.

Expectation

symbol that doesn't present in source (in this case [4:19..5:9) => _empty_/Main$package.given_Stuff_String.) shouldn't be registered as SymbolOccurrence.

pikinier20 commented 2 years ago

@tanishiking Based on other issues, you're the most active maintainer in this area. Would you mind assigning you to this issue?

tanishiking commented 2 years ago

@pikinier20 Sure! actually I already submit a PR https://github.com/lampepfl/dotty/pull/15143 :)