Skip to content

Commit 5c1785e

Browse files
committed
Restore previous unapply and homogenize staged method names
1 parent 7ed9a69 commit 5c1785e

File tree

2 files changed

+24
-23
lines changed

2 files changed

+24
-23
lines changed

library/src-bootstrapped/scala/StagedTuple.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ object StagedTuple {
177177
}
178178
}
179179

180-
def stagedCons[T <: Tuple & Singleton : Type, H : Type](self: Expr[T], x: Expr[H], tailSize: Option[Int]): Expr[H *: T] =
180+
def consStaged[T <: Tuple & Singleton : Type, H : Type](self: Expr[T], x: Expr[H], tailSize: Option[Int]): Expr[H *: T] =
181181
if (!specialize) '{dynamic_*:[T, H]($self, $x)}
182182
else {
183183
val res = tailSize match {
@@ -199,7 +199,7 @@ object StagedTuple {
199199
res.as[H *: T]
200200
}
201201

202-
def stagedConcat[Self <: Tuple & Singleton : Type, That <: Tuple & Singleton : Type](self: Expr[Self], selfSize: Option[Int], that: Expr[That], thatSize: Option[Int]): Expr[Concat[Self, That]] = {
202+
def concatStaged[Self <: Tuple & Singleton : Type, That <: Tuple & Singleton : Type](self: Expr[Self], selfSize: Option[Int], that: Expr[That], thatSize: Option[Int]): Expr[Concat[Self, That]] = {
203203
if (!specialize) '{dynamic_++[Self, That]($self, $that)}
204204
else {
205205
def genericConcat(xs: Expr[Tuple], ys: Expr[Tuple]): Expr[Tuple] =
@@ -211,7 +211,7 @@ object StagedTuple {
211211
that
212212
case Some(1) =>
213213
if (thatSize.contains(0)) self
214-
else stagedCons(that, '{$self.asInstanceOf[Tuple1[_]]._1}, thatSize)
214+
else consStaged(that, '{$self.asInstanceOf[Tuple1[_]]._1}, thatSize)
215215
case Some(2) =>
216216
val self2 = self.as[Tuple2[_, _]]
217217
thatSize match {

library/src-bootstrapped/scala/Tuple.scala

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sealed trait Tuple extends Any {
77
import Tuple._
88

99
inline def toArray: Array[Object] =
10-
if (stageIt) stagedToArray
10+
if (stageIt) toArrayStaged
1111
else inline constValueOpt[BoundedSize[this.type]] match {
1212
case Some(0) =>
1313
empty$Array
@@ -31,11 +31,11 @@ sealed trait Tuple extends Any {
3131
dynamicToArray(this)
3232
}
3333

34-
inline def stagedToArray: Array[Object] =
34+
inline def toArrayStaged: Array[Object] =
3535
${ StagedTuple.toArrayStaged('this, constValueOpt[BoundedSize[this.type]]) }
3636

3737
inline def *: [H, This >: this.type <: Tuple] (x: H): H *: This =
38-
if (stageIt) stagedCons[H](x)
38+
if (stageIt) consStaged[H](x)
3939
else {
4040
type Result = H *: This
4141
inline constValueOpt[BoundedSize[this.type]] match {
@@ -59,11 +59,11 @@ sealed trait Tuple extends Any {
5959
}
6060
}
6161

62-
inline def stagedCons[H] (x: H): H *: this.type =
63-
${ StagedTuple.stagedCons('this, 'x, constValueOpt[BoundedSize[this.type]]) }
62+
inline def consStaged[H] (x: H): H *: this.type =
63+
${ StagedTuple.consStaged('this, 'x, constValueOpt[BoundedSize[this.type]]) }
6464

6565
inline def ++ [This >: this.type <: Tuple](that: Tuple): Concat[This, that.type] =
66-
if (stageIt) stagedConcat(that).asInstanceOf
66+
if (stageIt) concatStaged(that).asInstanceOf
6767
else {
6868
type Result = Concat[This, that.type]
6969
inline constValueOpt[BoundedSize[this.type]] match {
@@ -103,15 +103,15 @@ sealed trait Tuple extends Any {
103103
}
104104
}
105105

106-
inline def stagedConcat(that: Tuple): Concat[this.type, that.type] =
107-
${ StagedTuple.stagedConcat('this, constValueOpt[BoundedSize[this.type]],
106+
inline def concatStaged(that: Tuple): Concat[this.type, that.type] =
107+
${ StagedTuple.concatStaged('this, constValueOpt[BoundedSize[this.type]],
108108
'that, constValueOpt[BoundedSize[that.type]]) }
109109

110110
inline def genericConcat[T <: Tuple](xs: Tuple, ys: Tuple): Tuple =
111111
fromArray[T](xs.toArray ++ ys.toArray)
112112

113113
inline def size[This >: this.type <: Tuple]: Size[This] =
114-
if (stageIt) stagedSize.asInstanceOf
114+
if (stageIt) sizeStaged.asInstanceOf
115115
else {
116116
type Result = Size[This]
117117
inline constValueOpt[BoundedSize[this.type]] match {
@@ -120,15 +120,15 @@ sealed trait Tuple extends Any {
120120
}
121121
}
122122

123-
inline def stagedSize: Size[this.type] =
123+
inline def sizeStaged: Size[this.type] =
124124
${ StagedTuple.sizeStaged[Size[this.type]]('this, constValueOpt[BoundedSize[this.type]]) }
125125
}
126126

127127
object Tuple {
128128
inline val MaxSpecialized = 22
129129
inline private val XXL = MaxSpecialized + 1
130130

131-
final val stageIt = false
131+
final val stageIt = true
132132

133133
type Head[X <: NonEmptyTuple] = X match {
134134
case x *: _ => x
@@ -188,7 +188,7 @@ object Tuple {
188188
}
189189

190190
inline def fromArray[T <: Tuple](xs: Array[Object]): T =
191-
if (stageIt) stagedFromArray[T](xs)
191+
if (stageIt) fromArrayStaged[T](xs)
192192
else inline constValue[BoundedSize[T]] match {
193193
case 0 => ().asInstanceOf[T]
194194
case 1 => Tuple1(xs(0)).asInstanceOf[T]
@@ -216,7 +216,7 @@ object Tuple {
216216
case _ => TupleXXL(xs).asInstanceOf[T]
217217
}
218218

219-
inline def stagedFromArray[T <: Tuple](xs: Array[Object]): T =
219+
inline def fromArrayStaged[T <: Tuple](xs: Array[Object]): T =
220220
${ StagedTuple.fromArrayStaged[T]('xs, constValueOpt[BoundedSize[this.type]]) }
221221

222222
def dynamicFromArray[T <: Tuple](xs: Array[Object]): T = xs.length match {
@@ -312,7 +312,7 @@ sealed trait NonEmptyTuple extends Tuple {
312312
import NonEmptyTuple._
313313

314314
inline def head[This >: this.type <: NonEmptyTuple]: Head[This] =
315-
if (stageIt) stagedHead.asInstanceOf
315+
if (stageIt) headStaged.asInstanceOf
316316
else {
317317
type Result = Head[This]
318318
val resVal = inline constValueOpt[BoundedSize[this.type]] match {
@@ -339,11 +339,11 @@ sealed trait NonEmptyTuple extends Tuple {
339339
resVal.asInstanceOf[Result]
340340
}
341341

342-
inline def stagedHead: Head[this.type] =
342+
inline def headStaged: Head[this.type] =
343343
${ StagedTuple.headStaged[this.type]('this, constValueOpt[BoundedSize[this.type]]) }
344344

345345
inline def tail[This >: this.type <: NonEmptyTuple]: Tail[This] =
346-
if (stageIt) stagedTail.asInstanceOf
346+
if (stageIt) tailStaged.asInstanceOf
347347
else {
348348
type Result = Tail[This]
349349
inline constValueOpt[BoundedSize[this.type]] match {
@@ -368,7 +368,7 @@ sealed trait NonEmptyTuple extends Tuple {
368368
}
369369
}
370370

371-
inline def stagedTail: Tail[this.type] =
371+
inline def tailStaged: Tail[this.type] =
372372
${ StagedTuple.tailStaged[this.type]('this, constValueOpt[BoundedSize[this.type]]) }
373373

374374
inline def fallbackApply(n: Int) =
@@ -378,7 +378,7 @@ sealed trait NonEmptyTuple extends Tuple {
378378
}
379379

380380
inline def apply[This >: this.type <: NonEmptyTuple](n: Int): Elem[This, n.type] =
381-
if (stageIt) stagedApply(n).asInstanceOf
381+
if (stageIt) applyStaged(n).asInstanceOf
382382
else {
383383
type Result = Elem[This, n.type]
384384
inline constValueOpt[Size[this.type]] match {
@@ -428,7 +428,7 @@ sealed trait NonEmptyTuple extends Tuple {
428428
}
429429
}
430430

431-
inline def stagedApply(n: Int): Elem[this.type, n.type] =
431+
inline def applyStaged(n: Int): Elem[this.type, n.type] =
432432
${ StagedTuple.applyStaged[this.type, n.type](
433433
'this, constValueOpt[Size[this.type]],
434434
'n, constValueOpt[n.type]) }
@@ -476,5 +476,6 @@ object NonEmptyTuple {
476476
sealed class *:[+H, +T <: Tuple] extends NonEmptyTuple
477477

478478
object *: {
479-
inline def unapply[H, T <: Tuple](x: H *: T) = (x.head, x.tail)
479+
inline def unapply[H, T <: Tuple](x: H *: T) =
480+
(NonEmptyTuple.dynamicHead(x), NonEmptyTuple.dynamicTail(x))
480481
}

0 commit comments

Comments
 (0)