Skip to content

Commit 1ae7d54

Browse files
committed
WIP better testcase
1 parent 2ab03ae commit 1ae7d54

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

tests/pos/i4884.scala

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
object Test {
22
trait A
33
trait TestConstructor1 { type F[_ <: A] }
4-
trait TestConstructor2[D] { type F[_ <: D] }
4+
trait TestConstructor2[D] {
5+
type F[_ <: D]
6+
class G[X <: D]
7+
trait TestConstructor3[E] {
8+
type G[_ <: D & E]
9+
class H[X <: D & E]
10+
}
11+
}
512

613
val v1: TestConstructor1 => Unit = { f =>
714
type P[a <: A] = f.F[a] // OK
@@ -10,4 +17,25 @@ object Test {
1017
val v2: TestConstructor2[A] => Unit = { f =>
1118
type P[a <: A] = f.F[a] // Error! Type argument a does not conform to upper bound D
1219
}
20+
21+
def f2(f: TestConstructor2[A]): Unit = {
22+
type P[a <: A] = f.F[a] // Error! Type argument a does not conform to upper bound D
23+
}
24+
25+
// val v3: (f: TestConstructor2[A]) => (g: f.TestConstructor3[A]) => Unit = { f => g =>
26+
// type P[a <: A] = f.F[a] // Error! Type argument a does not conform to upper bound D
27+
// // type Q[a <: A] = g.G[a]
28+
// // type R[a <: A] = (f.F & g.G)[a]
29+
// // type R[a <: A] = ([X] => f.F[X] & g.G[X])[a]
30+
// }
31+
def f3(f: TestConstructor2[A], g: f.TestConstructor3[A]): Unit = {
32+
type P[a <: A] = f.F[a] // Error! Type argument a does not conform to upper bound D
33+
type Q[a <: A] = g.G[a]
34+
// type R[a <: A] = (f.F & g.G)[a] // compiler error
35+
type R[a <: A] = ([X <: A] => f.F[X] & g.G[X])[a]
36+
type S[a <: A] = f.G[a] & g.H[a]
37+
}
38+
//val v4: (f: TestConstructor2[A]) => (g: f.TestConstructor3[A]) => Unit = {f => ???} // crash
39+
//val v5: (f: TestConstructor2[A]) => (g: f.TestConstructor3[A]) => Unit = {(f: TestConstructor2[A]) => ???} // crash
40+
//val v6: (f: TestConstructor2[A]) => (g: f.TestConstructor3[A]) => Unit = {(f: TestConstructor2[A]) => (g: f.TestConstructor3[A]) => ???} // crash
1341
}

0 commit comments

Comments
 (0)