scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

No Semanticdb generated for lifted args

Open rochala opened this issue 11 months ago • 1 comments

Compiler version

3.4.0

Minimized code

Semanticdb does not include occurences in lifted args. It can affect also other scenarios, but this one is a nice minimisation.

object T:
  def enrichedCompilerCompletions() =
    val compilerCompletions: Seq[String] = ???

    compilerCompletions
      .toList
      .filterInteresting()

  extension (l: List[String])
    def filterInteresting(qualType: String = ""): List[String] = ???

Output

[[syntax trees at end of                     typer]] 
package <empty>#106 {
  final lazy module val T: T#123 = new T#123#124#125()#126#127
  final module class T() extends Object#181#186#187()#188 {
    this: T#128.type#129 =>
    def enrichedCompilerCompletions(): List[String]#386 =
      {
        val compilerCompletions: Seq#37[String#42]#44 = ???#48#51
        {
          val l$1: List[String]#350 = compilerCompletions#52.toList#54#352
          T.filterInteresting#344(l$1#353)#355(
            this#357.filterInteresting$default$2#358(l$1#353)#359)#367
        }#368
      }#370
    #388
    extension (l: List#64[String#69]#71#76) def filterInteresting(
      qualType: String#79#150): List#87[String#92]#94 = ???#98#152
    def filterInteresting$default$2(l: List#64[String#69]#71#360):
      String @uncheckedVariance#365 = ""#83#389
  }#393
}#394

With semanticdb:

Test.scala
----------

Summary:
Schema => SemanticDB v4
Uri => Test.scala
Text => empty
Language => Scala
Symbols => 9 entries
Occurrences => 17 entries

Symbols:
_empty_/T. => final object T extends Object { self: T.type => +4 decls }
_empty_/T.enrichedCompilerCompletions(). => method enrichedCompilerCompletions(): List[String]
_empty_/T.filterInteresting$default$2(). => method filterInteresting$default$2(l: List[String]): String @uncheckedVariance
_empty_/T.filterInteresting$default$2().(l) => param l: List[String]
_empty_/T.filterInteresting(). => method filterInteresting(l: List[String])(qualType: String): List[String]
_empty_/T.filterInteresting().(l) => param l: List[String]
_empty_/T.filterInteresting().(qualType) => param qualType: String
local0 => val local compilerCompletions: Seq[String]
local1 => val local l$1: List[String]

Occurrences:
[3:7..3:8) <= _empty_/T.
[4:6..4:33) <= _empty_/T.enrichedCompilerCompletions().
[5:8..5:27) <= local0
[5:29..5:32) => scala/package.Seq#
[5:33..5:39) => scala/Predef.String#
[5:43..5:46) => scala/Predef.`???`().
[9:7..9:24) => _empty_/T.filterInteresting().
[11:13..11:14) <= _empty_/T.filterInteresting$default$2().(l)
[11:13..11:14) <= _empty_/T.filterInteresting().(l)
[11:16..11:20) => scala/package.List#
[11:21..11:27) => scala/Predef.String#
[12:8..12:25) <= _empty_/T.filterInteresting().
[12:26..12:34) <= _empty_/T.filterInteresting().(qualType)
[12:36..12:42) => scala/Predef.String#
[12:50..12:54) => scala/package.List#
[12:55..12:61) => scala/Predef.String#
[12:65..12:68) => scala/Predef.`???`().

Expectation

Semanticdb should properly find occurences for val l$1: List[String]#350 = compilerCompletions#52.toList#54#352 after lifting.

rochala avatar Mar 18 '24 10:03 rochala