@@ -12,31 +12,31 @@ object Test {
12
12
def main (args : Array [String ]): Unit = {
13
13
fun1(phantasmic[PhantomAny ])
14
14
fun1(phantasmic[Blinky ])
15
- fun1(phantasmic[ Inky ] )
16
- fun1(phantasmic[ Pinky ] )
15
+ fun1(new Inky {} )
16
+ fun1(new Pinky )
17
17
fun1(phantasmic[Clyde ])
18
18
19
19
fun1(phantasmic[PhantomNothing ])
20
20
fun2(phantasmic[PhantomNothing ])
21
21
22
22
fun3(phantasmic[PhantomAny ], phantasmic[PhantomNothing ])
23
23
fun3(phantasmic[Blinky ], phantasmic[PhantomNothing ])
24
- fun3(phantasmic[ Inky ] , phantasmic[PhantomNothing ])
25
- fun3(phantasmic[ Pinky ] , phantasmic[PhantomNothing ])
24
+ fun3(new Inky {} , phantasmic[PhantomNothing ])
25
+ fun3(new Pinky , phantasmic[PhantomNothing ])
26
26
fun3(phantasmic[Clyde ], phantasmic[PhantomNothing ])
27
27
fun3(phantasmic[PhantomNothing ], phantasmic[PhantomNothing ])
28
28
29
29
fun4(1 , 2 )(phantasmic[PhantomAny ], phantasmic[PhantomNothing ])
30
30
fun4(3 , 4 )(phantasmic[Blinky ], phantasmic[PhantomNothing ])
31
- fun4(5 , 6 )(phantasmic[ Inky ] , phantasmic[PhantomNothing ])
32
- fun4(7 , 8 )(phantasmic[ Pinky ] , phantasmic[PhantomNothing ])
31
+ fun4(5 , 6 )(new Inky {} , phantasmic[PhantomNothing ])
32
+ fun4(7 , 8 )(new Pinky , phantasmic[PhantomNothing ])
33
33
fun4(9 , 10 )(phantasmic[Clyde ], phantasmic[PhantomNothing ])
34
34
fun4(11 , 12 )(phantasmic[PhantomNothing ], phantasmic[PhantomNothing ])
35
35
36
36
fun5(phantasmic[PhantomAny ], phantasmic[PhantomNothing ])(13 , 14 )
37
37
fun5(phantasmic[Blinky ], phantasmic[PhantomNothing ])(15 , 16 )
38
- fun5(phantasmic[ Inky ] , phantasmic[PhantomNothing ])(17 , 18 )
39
- fun5(phantasmic[ Pinky ] , phantasmic[PhantomNothing ])(19 , 20 )
38
+ fun5(new Inky {} , phantasmic[PhantomNothing ])(17 , 18 )
39
+ fun5(new Pinky , phantasmic[PhantomNothing ])(19 , 20 )
40
40
fun5(phantasmic[Clyde ], phantasmic[PhantomNothing ])(21 , 22 )
41
41
fun5(phantasmic[PhantomNothing ], phantasmic[PhantomNothing ])(23 , 24 )
42
42
@@ -46,40 +46,40 @@ object Test {
46
46
polyfun2(new Boo6 ().boo1)
47
47
polyfun2(new Boo6 ().boo2)
48
48
polyfun2(phantasmic[Blinky ])
49
- polyfun2(phantasmic[ Inky ] )
50
- polyfun2(phantasmic[ Pinky ] )
49
+ polyfun2(new Inky {} )
50
+ polyfun2(new Pinky )
51
51
polyfun2(phantasmic[Clyde ])
52
52
polyfun2(phantasmic[PhantomNothing ])
53
53
54
54
polyfun3(phantasmic[PhantomAny ])
55
55
polyfun3(new Boo6 ().boo1)
56
56
polyfun3(new Boo6 ().boo2)
57
57
polyfun3(phantasmic[Blinky ])
58
- polyfun3(phantasmic[ Inky ] )
59
- polyfun3(phantasmic[ Pinky ] )
58
+ polyfun3(new Inky {} )
59
+ polyfun3(new Pinky )
60
60
polyfun3(phantasmic[Clyde ])
61
61
polyfun3(phantasmic[PhantomNothing ])
62
62
63
63
polyfun4(phantasmic[PhantomAny ])
64
64
polyfun4(new Boo6 ().boo1)
65
65
polyfun4(new Boo6 ().boo2)
66
66
polyfun4(phantasmic[Blinky ])
67
- polyfun4(phantasmic[ Inky ] )
68
- polyfun4(phantasmic[ Pinky ] )
67
+ polyfun4(new Inky {} )
68
+ polyfun4(new Pinky )
69
69
polyfun4(phantasmic[Clyde ])
70
70
polyfun4(phantasmic[PhantomNothing ])
71
71
72
72
new Boo1 [PhantomAny ]().polyfun1(phantasmic[PhantomAny ])
73
73
new Boo1 [PhantomAny ]().polyfun1(phantasmic[Blinky ])
74
- new Boo1 [PhantomAny ]().polyfun1(phantasmic[ Inky ] )
74
+ new Boo1 [PhantomAny ]().polyfun1(new Inky {} )
75
75
new Boo1 [PhantomAny ]().polyfun1(phantasmic[PhantomNothing ])
76
76
new Boo1 [Blinky ]().polyfun1(phantasmic[Clyde ])
77
77
new Boo1 [PhantomNothing ]().polyfun1(phantasmic[PhantomNothing ])
78
78
79
79
new Boo2 ().polyfun1(phantasmic[PhantomAny ])
80
80
new Boo2 ().polyfun1(phantasmic[Blinky ])
81
- new Boo2 ().polyfun1(phantasmic[ Inky ] )
82
- new Boo2 ().polyfun1(phantasmic[ Pinky ] )
81
+ new Boo2 ().polyfun1(new Inky {} )
82
+ new Boo2 ().polyfun1(new Pinky )
83
83
new Boo2 ().polyfun1(phantasmic[Clyde ])
84
84
new Boo2 ().polyfun1(phantasmic[PhantomNothing ])
85
85
@@ -88,7 +88,7 @@ object Test {
88
88
}.polyfun1(phantasmic[PhantomAny ])
89
89
new Boo3 (){
90
90
type Boo = PhantomAny
91
- }.polyfun1(phantasmic[ Pinky ] )
91
+ }.polyfun1(new Pinky )
92
92
new Boo3 (){
93
93
type Boo = Blinky
94
94
}.polyfun1(phantasmic[Blinky ])
@@ -101,8 +101,8 @@ object Test {
101
101
102
102
new Boo4 (phantasmic[PhantomAny ])
103
103
new Boo4 (phantasmic[Blinky ])
104
- new Boo4 (phantasmic[ Inky ] )
105
- new Boo4 (phantasmic[ Pinky ] )
104
+ new Boo4 (new Inky {} )
105
+ new Boo4 (new Pinky )
106
106
new Boo4 (phantasmic[Clyde ])
107
107
new Boo4 (phantasmic[PhantomNothing ])
108
108
@@ -114,22 +114,22 @@ object Test {
114
114
115
115
fun(phantomFun2(phantasmic[PhantomAny ]))
116
116
fun(phantomFun2(phantasmic[Blinky ]))
117
- fun(phantomFun2(phantasmic[ Inky ] ))
118
- fun(phantomFun2(phantasmic[ Pinky ] ))
117
+ fun(phantomFun2(new Inky {} ))
118
+ fun(phantomFun2(new Pinky ))
119
119
fun(phantomFun2(phantasmic[Clyde ]))
120
120
fun(phantomFun2(phantasmic[PhantomNothing ]))
121
121
122
122
fun(phantomFun3(phantasmic[PhantomAny ]))
123
123
fun(phantomFun3(phantasmic[Blinky ]))
124
- fun(phantomFun3(phantasmic[ Inky ] ))
125
- fun(phantomFun3(phantasmic[ Pinky ] ))
124
+ fun(phantomFun3(new Inky {} ))
125
+ fun(phantomFun3(new Pinky ))
126
126
fun(phantomFun3(phantasmic[Clyde ]))
127
127
fun(phantomFun3(phantasmic[PhantomNothing ]))
128
128
129
129
fun(phantomFun4(phantasmic[PhantomAny ]))
130
130
fun(phantomFun4(phantasmic[Blinky ]))
131
- fun(phantomFun4(phantasmic[ Inky ] ))
132
- fun(phantomFun4(phantasmic[ Pinky ] ))
131
+ fun(phantomFun4(new Inky {} ))
132
+ fun(phantomFun4(new Pinky ))
133
133
fun(phantomFun4(phantasmic[Clyde ]))
134
134
fun(phantomFun4(phantasmic[PhantomNothing ]))
135
135
@@ -148,26 +148,28 @@ object Test {
148
148
149
149
hkFun1(phantasmic[PhantomAny ])
150
150
hkFun1(phantasmic[Blinky ])
151
- hkFun1(phantasmic[ Inky ] )
152
- hkFun1(phantasmic[ Pinky ] )
151
+ hkFun1(new Inky {} )
152
+ hkFun1(new Pinky )
153
153
hkFun1(phantasmic[Clyde ])
154
154
hkFun1(phantasmic[PhantomNothing ])
155
155
156
156
fun(hkFun2(phantasmic[PhantomAny ]))
157
157
fun(hkFun2(phantasmic[Blinky ]))
158
- fun(hkFun2(phantasmic[ Inky ] ))
159
- fun(hkFun2(phantasmic[ Pinky ] ))
158
+ fun(hkFun2(new Inky {} ))
159
+ fun(hkFun2(new Pinky ))
160
160
fun(hkFun2(phantasmic[Clyde ]))
161
161
fun(hkFun2(phantasmic[PhantomNothing ]))
162
162
}
163
163
164
164
trait Phantoms {
165
- type Blinky <: PhantomAny
166
- type Inky <: Blinky
167
- type Pinky <: Inky
168
165
type Clyde >: Pinky <: Inky
169
166
}
170
- object Phantoms extends Phantoms
167
+
168
+ object Phantoms extends Phantoms {
169
+ trait Blinky extends PhantomAny
170
+ abstract class Inky extends Blinky
171
+ class Pinky extends Inky
172
+ }
171
173
172
174
def fun (top : PhantomAny ): Unit = ()
173
175
@@ -253,13 +255,13 @@ object Test {
253
255
def phantomFun3 [P <: PhantomAny ](p : P ): PhantomAny = p
254
256
def phantomFun4 [P <: PhantomAny ](p : P ): P = p
255
257
256
- def pacFun1 (blinky : Phantoms . Blinky ) = {
258
+ def pacFun1 (blinky : Blinky ) = {
257
259
println(" customPhantomsFun1" )
258
260
}
259
- def pacFun2 (pinky : Phantoms . Pinky ) = {
261
+ def pacFun2 (pinky : Pinky ) = {
260
262
println(" customPhantomsFun2" )
261
263
}
262
- def pacFun3 (clyde : Phantoms . Clyde ) = {
264
+ def pacFun3 (clyde : Clyde ) = {
263
265
println(" customPhantomsFun3" )
264
266
}
265
267
0 commit comments