@@ -34,10 +34,10 @@ sealed trait Tuple extends Any {
34
34
inline def stagedToArray : Array [Object ] =
35
35
$ { StagedTuple .toArrayStaged(' this , constValueOpt[BoundedSize [this .type ]]) }
36
36
37
- inline def *: [H ] (x : H ): H *: this . type =
37
+ inline def *: [H , This >: this . type <: Tuple ] (x : H ): H *: This =
38
38
if (stageIt) stagedCons[H ](x)
39
39
else {
40
- type Result = H *: this . type
40
+ type Result = H *: This
41
41
inline constValueOpt[BoundedSize [this .type ]] match {
42
42
case Some (0 ) =>
43
43
Tuple1 (x).asInstanceOf [Result ]
@@ -53,19 +53,19 @@ sealed trait Tuple extends Any {
53
53
val t = asInstanceOf [Tuple4 [_, _, _, _]]
54
54
Tuple5 (x, t._1, t._2, t._3, t._4).asInstanceOf [Result ]
55
55
case Some (n) =>
56
- fromArray[Result ](cons$Array (x, toArray))
56
+ fromArray[H *: this . type ](cons$Array (x, toArray))
57
57
case _ =>
58
- dynamic_*: [this . type , H ](this , x)
58
+ dynamic_*: [This , H ](this , x)
59
59
}
60
60
}
61
61
62
62
inline def stagedCons [H ] (x : H ): H *: this .type =
63
63
$ { StagedTuple .stagedCons(' this , ' x , constValueOpt[BoundedSize [this .type ]]) }
64
64
65
- inline def ++ (that : Tuple ): Concat [this . type , that.type ] =
66
- if (stageIt) stagedConcat(that)
65
+ inline def ++ [ This >: this . type <: Tuple ] (that : Tuple ): Concat [This , that.type ] =
66
+ if (stageIt) stagedConcat(that). asInstanceOf
67
67
else {
68
- type Result = Concat [this . type , that.type ]
68
+ type Result = Concat [This , that.type ]
69
69
inline constValueOpt[BoundedSize [this .type ]] match {
70
70
case Some (0 ) =>
71
71
that.asInstanceOf [Result ]
@@ -99,7 +99,7 @@ sealed trait Tuple extends Any {
99
99
if (constValue[BoundedSize [that.type ]] == 0 ) this .asInstanceOf [Result ]
100
100
else genericConcat[Result ](this , that).asInstanceOf [Result ]
101
101
case None =>
102
- dynamic_++ [this . type , that.type ](this , that)
102
+ dynamic_++ [This , that.type ](this , that)
103
103
}
104
104
}
105
105
@@ -110,10 +110,10 @@ sealed trait Tuple extends Any {
110
110
inline def genericConcat [T <: Tuple ](xs : Tuple , ys : Tuple ): Tuple =
111
111
fromArray[T ](xs.toArray ++ ys.toArray)
112
112
113
- inline def size : Size [ this .type ] =
114
- if (stageIt) stagedSize
113
+ inline def size [ This >: this .type <: Tuple ] : Size [ This ] =
114
+ if (stageIt) stagedSize. asInstanceOf
115
115
else {
116
- type Result = Size [this . type ]
116
+ type Result = Size [This ]
117
117
inline constValueOpt[BoundedSize [this .type ]] match {
118
118
case Some (n) => n.asInstanceOf [Result ]
119
119
case _ => dynamicSize(this )
@@ -130,28 +130,28 @@ object Tuple {
130
130
131
131
final val stageIt = false
132
132
133
- type Head [+ X <: NonEmptyTuple ] = X match {
133
+ type Head [X <: NonEmptyTuple ] = X match {
134
134
case x *: _ => x
135
135
}
136
136
137
- type Tail [+ X <: NonEmptyTuple ] <: Tuple = X match {
137
+ type Tail [X <: NonEmptyTuple ] <: Tuple = X match {
138
138
case _ *: xs => xs
139
139
}
140
140
141
- type Concat [+ X <: Tuple , + Y <: Tuple ] <: Tuple = X match {
141
+ type Concat [X <: Tuple , + Y <: Tuple ] <: Tuple = X match {
142
142
case Unit => Y
143
143
case x1 *: xs1 => x1 *: Concat [xs1, Y ]
144
144
}
145
145
146
- type Elem [+ X <: Tuple , + N ] = X match {
146
+ type Elem [X <: Tuple , N ] = X match {
147
147
case x *: xs =>
148
148
N match {
149
149
case 0 => x
150
150
case S [n1] => Elem [xs, n1]
151
151
}
152
152
}
153
153
154
- type Size [+ X ] <: Int = X match {
154
+ type Size [X ] <: Int = X match {
155
155
case Unit => 0
156
156
case x *: xs => S [Size [xs]]
157
157
}
@@ -311,10 +311,10 @@ sealed trait NonEmptyTuple extends Tuple {
311
311
import Tuple ._
312
312
import NonEmptyTuple ._
313
313
314
- inline def head : Head [ this .type ] =
315
- if (stageIt) stagedHead
314
+ inline def head [ This >: this .type <: NonEmptyTuple ] : Head [ This ] =
315
+ if (stageIt) stagedHead. asInstanceOf
316
316
else {
317
- type Result = Head [this . type ]
317
+ type Result = Head [This ]
318
318
val resVal = inline constValueOpt[BoundedSize [this .type ]] match {
319
319
case Some (1 ) =>
320
320
val t = asInstanceOf [Tuple1 [_]]
@@ -342,10 +342,10 @@ sealed trait NonEmptyTuple extends Tuple {
342
342
inline def stagedHead : Head [this .type ] =
343
343
$ { StagedTuple .headStaged[this .type ](' this , constValueOpt[BoundedSize [this .type ]]) }
344
344
345
- inline def tail : Tail [ this .type ] =
346
- if (stageIt) stagedTail
345
+ inline def tail [ This >: this .type <: NonEmptyTuple ] : Tail [ This ] =
346
+ if (stageIt) stagedTail. asInstanceOf
347
347
else {
348
- type Result = Tail [this . type ]
348
+ type Result = Tail [This ]
349
349
inline constValueOpt[BoundedSize [this .type ]] match {
350
350
case Some (1 ) =>
351
351
().asInstanceOf [Result ]
@@ -364,7 +364,7 @@ sealed trait NonEmptyTuple extends Tuple {
364
364
case Some (n) if n > 5 =>
365
365
fromArray[Result ](toArray.tail)
366
366
case None =>
367
- dynamicTail[this . type ](this )
367
+ dynamicTail[This ](this )
368
368
}
369
369
}
370
370
@@ -377,10 +377,10 @@ sealed trait NonEmptyTuple extends Tuple {
377
377
case None => dynamicApply[this .type ](this , n)
378
378
}
379
379
380
- inline def apply (n : Int ): Elem [this . type , n.type ] =
381
- if (stageIt) stagedApply(n)
380
+ inline def apply [ This >: this . type <: NonEmptyTuple ] (n : Int ): Elem [This , n.type ] =
381
+ if (stageIt) stagedApply(n). asInstanceOf
382
382
else {
383
- type Result = Elem [this . type , n.type ]
383
+ type Result = Elem [This , n.type ]
384
384
inline constValueOpt[Size [this .type ]] match {
385
385
case Some (1 ) =>
386
386
val t = asInstanceOf [Tuple1 [_]]
0 commit comments