File tree Expand file tree Collapse file tree 1 file changed +28
-4
lines changed Expand file tree Collapse file tree 1 file changed +28
-4
lines changed Original file line number Diff line number Diff line change 1
1
object Test {
2
2
trait A
3
+ trait B
3
4
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
+ }
5
13
6
14
val v1 : TestConstructor1 => Unit = { f =>
7
- type P [a <: A ] = f.F [a] // OK
15
+ type P [a <: A ] = f.F [a]
8
16
}
9
17
10
18
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]
12
36
}
13
- }
37
+ }
You can’t perform that action at this time.
0 commit comments