Skip to content

compile dotty with Ysemanticdb #8983

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 11 commits into from
May 19, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ class ExtractSemanticDB extends Phase:
else
decls0
end decls
val alts = decls.filter(_.is(Method)).toList.reverse
val alts = decls.filter(_.isOneOf(Method | Mutable)).toList.reverse
alts match
case notSym :: rest if sym != notSym =>
val idx = rest.indexOf(sym).ensuring(_ >= 0)
Expand Down
6 changes: 6 additions & 0 deletions tests/semanticdb/expect/MethodUsages.expect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ class MethodUsages/*<-example::MethodUsages#*/ {
m/*->example::MethodUsages#m.*/.m18/*->example::Methods#m18().*/(1)
m/*->example::MethodUsages#m.*/.m18/*->example::Methods#m18(+1).*/("")
}

object MethodUsages/*<-example::MethodUsages.*/ {
var x/*<-example::MethodUsages.x().*/: Int/*->scala::Int#*/ = 1
def x/*<-example::MethodUsages.x(+1).*/(n/*<-example::MethodUsages.x(+1).(n)*/: String/*->scala::Predef.String#*/): Int/*->scala::Int#*/ = /*->scala::Predef.augmentString().*/n/*->example::MethodUsages.x(+1).(n)*/.toInt/*->scala::collection::StringOps#toInt().*/
def foo/*<-example::MethodUsages.foo().*/: Int/*->scala::Int#*/ = x/*->example::MethodUsages.x().*/ +/*->scala::Int#`+`(+4).*/ x/*->example::MethodUsages.x(+1).*/("22")
}
6 changes: 6 additions & 0 deletions tests/semanticdb/expect/MethodUsages.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ class MethodUsages {
m.m18(1)
m.m18("")
}

object MethodUsages {
var x: Int = 1
def x(n: String): Int = n.toInt
def foo: Int = x + x("22")
}
26 changes: 24 additions & 2 deletions tests/semanticdb/metac.expect
Original file line number Diff line number Diff line change
Expand Up @@ -1616,13 +1616,20 @@ Schema => SemanticDB v4
Uri => MethodUsages.scala
Text => empty
Language => Scala
Symbols => 3 entries
Occurrences => 76 entries
Symbols => 10 entries
Occurrences => 91 entries

Symbols:
example/MethodUsages# => class MethodUsages
example/MethodUsages#`<init>`(). => primary ctor <init>
example/MethodUsages#m. => val method m
example/MethodUsages. => final object MethodUsages
example/MethodUsages.`x_=`(). => var method x_=
example/MethodUsages.`x_=`().(x$1) => param x$1
example/MethodUsages.foo(). => method foo
example/MethodUsages.x(). => var method x
example/MethodUsages.x(+1). => method x
example/MethodUsages.x(+1).(n) => param n

Occurrences:
[0:8..0:15): example <- example/
Expand Down Expand Up @@ -1701,6 +1708,21 @@ Occurrences:
[29:4..29:7): m18 -> example/Methods#m18().
[30:2..30:3): m -> example/MethodUsages#m.
[30:4..30:7): m18 -> example/Methods#m18(+1).
[33:7..33:19): MethodUsages <- example/MethodUsages.
[34:6..34:7): x <- example/MethodUsages.x().
[34:9..34:12): Int -> scala/Int#
[35:6..35:7): x <- example/MethodUsages.x(+1).
[35:8..35:9): n <- example/MethodUsages.x(+1).(n)
[35:11..35:17): String -> scala/Predef.String#
[35:20..35:23): Int -> scala/Int#
[35:26..35:26): -> scala/Predef.augmentString().
[35:26..35:27): n -> example/MethodUsages.x(+1).(n)
[35:28..35:33): toInt -> scala/collection/StringOps#toInt().
[36:6..36:9): foo <- example/MethodUsages.foo().
[36:11..36:14): Int -> scala/Int#
[36:17..36:18): x -> example/MethodUsages.x().
[36:19..36:20): + -> scala/Int#`+`(+4).
[36:21..36:22): x -> example/MethodUsages.x(+1).

expect/Methods.scala
--------------------
Expand Down