@@ -27,8 +27,8 @@ object test:
27
27
def apply [C , E ]: apply[C , E ] = new apply[C , E ]
28
28
29
29
class combine [A , B ](
30
- val f : Combinator [A ],
31
- val s : Combinator [B ] { type Context = f.Context }
30
+ tracked val f : Combinator [A ],
31
+ tracked val s : Combinator [B ] { type Context = f.Context }
32
32
) extends Combinator [Combine [A , B ]]:
33
33
type Context = f.Context
34
34
type Element = (f.Element , s.Element )
@@ -38,10 +38,7 @@ object test:
38
38
def combine [A , B ](
39
39
_f : Combinator [A ],
40
40
_s : Combinator [B ] { type Context = _f.Context }
41
- ): combine[A , B ] {
42
- type Context = _f.Context
43
- type Element = (_f.Element , _s.Element )
44
- } = new combine[A , B ](_f, _s).asInstanceOf
41
+ ) = new combine[A , B ](_f, _s)
45
42
// cast is needed since the type of new combine[A, B](_f, _s)
46
43
// drops the required refinement.
47
44
@@ -56,12 +53,10 @@ object test:
56
53
val n = Apply [mutable.ListBuffer [Int ], Int ](s => s.popFirst())
57
54
val m = Combine (n, n)
58
55
59
- val c = combine[
60
- Apply [mutable.ListBuffer [Int ], Int ],
61
- Apply [mutable.ListBuffer [Int ], Int ]
62
- ](
56
+ val c = combine(
63
57
apply[mutable.ListBuffer [Int ], Int ],
64
58
apply[mutable.ListBuffer [Int ], Int ]
65
59
)
66
- val r = c.parse(m)(stream) // type mismatch, found `mutable.ListBuffer[Int]`, required `?1.Context`
60
+ val r = c.parse(m)(stream) // was type mismatch, now OK
61
+ val rc : Option [(Int , Int )] = r
67
62
}
0 commit comments