1
+ object Test {
2
+ trait A
3
+ trait B
4
+ trait TestConstructor1 { type F [X <: A ]
5
+ trait FromSet [C [_ <: A with B ]]
6
+
7
+ trait MSetLike [X <: A with B , This <: MSet [X ] with MSetLike [X , This ]] {
8
+ def to [C [X <: A with B ] <: MSet [X ] with MSetLike [X , C [X ]]](fi : FromSet [C ]): C [X ] = ???
9
+ }
10
+ trait MSet [X <: A with B ] extends MSetLike [X , MSet [X ]]
11
+ object MSetFactory extends FromSet [MSet ]
12
+ }
13
+
14
+ trait TestConstructor4 [D ] {
15
+ trait TestConstructor5 [E ] {
16
+ trait FromSet [C [_ <: D with E ]]
17
+
18
+ trait MSetLike [X <: D with E , This <: MSet [X ] with MSetLike [X , This ]] {
19
+ def to [C [X <: D with E ] <: MSet [X ] with MSetLike [X , C [X ]]](fi : FromSet [C ]): C [X ] = ???
20
+ }
21
+ trait MSet [X <: D with E ] extends MSetLike [X , MSet [X ]]
22
+ object MSetFactory extends FromSet [MSet ]
23
+ }
24
+ }
25
+
26
+ type C = A & B
27
+ val v1 : TestConstructor1 => Unit = { f =>
28
+ type P [a <: A ] = f.F [a]
29
+
30
+ type P1 [c <: C ] = f.MSet [c]
31
+ (f.MSetFactory : f.FromSet [f.MSet ]): Unit
32
+ (x : P1 [C ]) => x.to(f.MSetFactory )
33
+ }
34
+
35
+ def f3 (f : TestConstructor4 [A ])(g : f.TestConstructor5 [B ]): Unit = {
36
+ type P1 [c <: C ] = g.MSet [c]
37
+ (g.MSetFactory : g.FromSet [g.MSet ]): Unit
38
+ (x : P1 [C ]) => x.to(g.MSetFactory )
39
+ (x : P1 [C ]) => x.to[g.MSet ](g.MSetFactory )
40
+ }
41
+ }
0 commit comments