Skip to content

Commit deecd9f

Browse files
Blaisorbladeodersky
authored andcommitted
Improve testcase
1 parent 3739026 commit deecd9f

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

tests/pos/i4884.scala

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,37 @@
11
object Test {
22
trait A
3+
trait B
34
trait TestConstructor1 { type F[_ <: A] }
4-
trait TestConstructor2[D] { type F[_ <: D] }
5+
trait TestConstructor2[D] {
6+
type F[_ <: D]
7+
class G[X <: D]
8+
trait TestConstructor3[E] {
9+
type G[_ <: D & E]
10+
class H[X <: D & E]
11+
}
12+
}
513

614
val v1: TestConstructor1 => Unit = { f =>
7-
type P[a <: A] = f.F[a] // OK
15+
type P[a <: A] = f.F[a]
816
}
917

1018
val v2: TestConstructor2[A] => Unit = { f =>
11-
type P[a <: A] = f.F[a] // Error! Type argument a does not conform to upper bound D
19+
type P[a <: A] = f.F[a]
20+
}
21+
22+
def f2(f: TestConstructor2[A]): Unit = {
23+
type P[a <: A] = f.F[a]
24+
}
25+
26+
type C = A & B
27+
def f3(f: TestConstructor2[A], g: f.TestConstructor3[B]): Unit = {
28+
type P1[a <: A] = f.F[a]
29+
type P2[a <: A] = f.G[a]
30+
type Q1[c <: C] = g.G[c]
31+
type Q2[c <: C] = g.H[c]
32+
type R1[c <: C] = f.G[c] & g.H[c]
33+
type R2[c <: C] = f.G[c] | g.H[c]
34+
type S1[c <: C] = ([X <: C] => f.F[X] & g.G[X])[c]
35+
type S2[c <: C] = ([X <: C] => f.F[X] | g.G[X])[c]
1236
}
13-
}
37+
}

0 commit comments

Comments
 (0)