Skip to content

Commit 9ebec04

Browse files
committed
Test cases
1 parent 29e3b79 commit 9ebec04

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

tests/neg/illegal-depmeth.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
object Test {
2+
3+
class C { type T }
4+
5+
def f(x: C, y: x.T): x.T = y // ok
6+
7+
def g(y: x.T, x: C): x.T = y // error
8+
9+
def h(x: x.T) = ??? // error
10+
11+
def g(x: => C): x.T = ??? // error: x is not stable
12+
13+
}

tests/pos/param-depmeth.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
object Test {
2+
3+
class C { type T }
4+
5+
def f(x: C, y: x.T): x.T = y // ok
6+
7+
val c = new C { type T = String }
8+
val c2 = c
9+
10+
f(c, "abc")
11+
f(new C{ type T = String}, "abc")
12+
13+
val d: (C{ type T = String}) # T = "abc"
14+
15+
}

0 commit comments

Comments
 (0)