Skip to content

Commit 78c9bc5

Browse files
committed
Add test for scala#11693
scala#11693 > scala3-compiler-bootstrapped/Test/runMain dotty.tools.dotc.semanticdb.updateExpect
1 parent 1f4d125 commit 78c9bc5

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

tests/semanticdb/expect/toplevel.expect.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,9 @@ def combine/*<-_empty_::toplevel$package.combine(+1).*/(x/*<-_empty_::toplevel$p
44
def combine/*<-_empty_::toplevel$package.combine(+2).*/ = 0
55
def foo/*<-_empty_::toplevel$package.foo().*/ = "foo"
66
/*<-_empty_::MyProgram#*//*->_empty_::toplevel$package.MyProgram().*//*->scala::util::CommandLineParser.parseArgument().*//*->_empty_::MyProgram#main().(args)*//*->scala::util::CommandLineParser.FromString.given_FromString_Int.*//*->scala::util::CommandLineParser.showError().*//*->local0*/@main/*->scala::main#*/ def MyProgram/*<-_empty_::toplevel$package.MyProgram().*/(times/*<-_empty_::toplevel$package.MyProgram().(times)*/: Int/*->scala::Int#*/): Unit/*->scala::Unit#*/ = (/*->scala::LowPriorityImplicits#intWrapper().*/1 to/*->scala::runtime::RichInt#to().*/ times/*->_empty_::toplevel$package.MyProgram().(times)*/) foreach/*->scala::collection::immutable::Range#foreach().*/ (_ => println/*->scala::Predef.println(+1).*/("hello"))
7+
8+
trait Ord/*<-_empty_::Ord#*/[T/*<-_empty_::Ord#[T]*/]:
9+
def compare/*<-_empty_::Ord#compare().*/(x/*<-_empty_::Ord#compare().(x)*/: T/*->_empty_::Ord#[T]*/, y/*<-_empty_::Ord#compare().(y)*/: T/*->_empty_::Ord#[T]*/): Int/*->scala::Int#*/
10+
11+
given intOrd/*<-_empty_::toplevel$package.intOrd.*/: Ord/*->_empty_::Ord#*/[Int/*->scala::Int#*/] with
12+
def compare/*<-_empty_::toplevel$package.intOrd.compare().*/(x/*<-_empty_::toplevel$package.intOrd.compare().(x)*/: Int/*->scala::Int#*/, y/*<-_empty_::toplevel$package.intOrd.compare().(y)*/: Int/*->scala::Int#*/) = ???/*->scala::Predef.`???`().*/

tests/semanticdb/expect/toplevel.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,9 @@ def combine(x: Int, y: Int, z: Int) = x + y + z
44
def combine = 0
55
def foo = "foo"
66
@main def MyProgram(times: Int): Unit = (1 to times) foreach (_ => println("hello"))
7+
8+
trait Ord[T]:
9+
def compare(x: T, y: T): Int
10+
11+
given intOrd: Ord[Int] with
12+
def compare(x: Int, y: Int) = ???

tests/semanticdb/metac.expect

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4277,14 +4277,20 @@ Schema => SemanticDB v4
42774277
Uri => toplevel.scala
42784278
Text => empty
42794279
Language => Scala
4280-
Symbols => 18 entries
4281-
Occurrences => 42 entries
4280+
Symbols => 28 entries
4281+
Occurrences => 60 entries
42824282

42834283
Symbols:
42844284
_empty_/MyProgram# => final class MyProgram
42854285
_empty_/MyProgram#`<init>`(). => primary ctor <init>
42864286
_empty_/MyProgram#main(). => static method main
42874287
_empty_/MyProgram#main().(args) => param args
4288+
_empty_/Ord# => trait Ord
4289+
_empty_/Ord#[T] => typeparam T
4290+
_empty_/Ord#`<init>`(). => primary ctor <init>
4291+
_empty_/Ord#compare(). => abstract method compare
4292+
_empty_/Ord#compare().(x) => param x
4293+
_empty_/Ord#compare().(y) => param y
42884294
_empty_/toplevel$package. => final package object _empty_
42894295
_empty_/toplevel$package.MyProgram(). => method MyProgram
42904296
_empty_/toplevel$package.MyProgram().(times) => param times
@@ -4298,6 +4304,10 @@ _empty_/toplevel$package.combine(+1).(y) => param y
42984304
_empty_/toplevel$package.combine(+1).(z) => param z
42994305
_empty_/toplevel$package.combine(+2). => method combine
43004306
_empty_/toplevel$package.foo(). => method foo
4307+
_empty_/toplevel$package.intOrd. => final implicit object intOrd
4308+
_empty_/toplevel$package.intOrd.compare(). => method compare
4309+
_empty_/toplevel$package.intOrd.compare().(x) => param x
4310+
_empty_/toplevel$package.intOrd.compare().(y) => param y
43014311
local0 => val local error
43024312

43034313
Occurrences:
@@ -4343,4 +4353,22 @@ Occurrences:
43434353
[5:46..5:51): times -> _empty_/toplevel$package.MyProgram().(times)
43444354
[5:53..5:60): foreach -> scala/collection/immutable/Range#foreach().
43454355
[5:67..5:74): println -> scala/Predef.println(+1).
4356+
[7:6..7:9): Ord <- _empty_/Ord#
4357+
[7:9..7:9): <- _empty_/Ord#`<init>`().
4358+
[7:10..7:11): T <- _empty_/Ord#[T]
4359+
[8:7..8:14): compare <- _empty_/Ord#compare().
4360+
[8:15..8:16): x <- _empty_/Ord#compare().(x)
4361+
[8:18..8:19): T -> _empty_/Ord#[T]
4362+
[8:21..8:22): y <- _empty_/Ord#compare().(y)
4363+
[8:24..8:25): T -> _empty_/Ord#[T]
4364+
[8:28..8:31): Int -> scala/Int#
4365+
[10:6..10:12): intOrd <- _empty_/toplevel$package.intOrd.
4366+
[10:14..10:17): Ord -> _empty_/Ord#
4367+
[10:18..10:21): Int -> scala/Int#
4368+
[11:7..11:14): compare <- _empty_/toplevel$package.intOrd.compare().
4369+
[11:15..11:16): x <- _empty_/toplevel$package.intOrd.compare().(x)
4370+
[11:18..11:21): Int -> scala/Int#
4371+
[11:23..11:24): y <- _empty_/toplevel$package.intOrd.compare().(y)
4372+
[11:26..11:29): Int -> scala/Int#
4373+
[11:33..11:36): ??? -> scala/Predef.`???`().
43464374

0 commit comments

Comments
 (0)