Skip to content

Commit 3a846cd

Browse files
authored
Merge pull request #6512 from dotty-staging/add-tuple-toArray-test
Add regression tests for Tuple and code some cleanup
2 parents 49f254a + 1209bd0 commit 3a846cd

File tree

9 files changed

+587
-41
lines changed

9 files changed

+587
-41
lines changed

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ class CompilationTests extends ParallelTesting {
197197
compileFile("tests/run-custom-args/i5256.scala", allowDeepSubtypes),
198198
compileFile("tests/run-custom-args/fors.scala", defaultOptions and "-strict"),
199199
compileFile("tests/run-custom-args/no-useless-forwarders.scala", defaultOptions and "-Xmixin-force-forwarders:false"),
200+
compileFilesInDir("tests/run-deep-subtype", allowDeepSubtypes),
200201
compileFilesInDir("tests/run", defaultOptions)
201202
).checkRuns()
202203
}

library/src-3.x/scala/Tuple.scala

Lines changed: 22 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ import annotation.showAsInfix
33
import compiletime._
44
import internal._
55

6+
import scala.runtime.DynamicTuple
7+
68
sealed trait Tuple extends Any {
79
import Tuple._
810

911
inline def toArray: Array[Object] =
1012
inline constValueOpt[BoundedSize[this.type]] match {
1113
case Some(0) =>
12-
scala.runtime.DynamicTuple.empty$Array
14+
DynamicTuple.empty$Array
1315
case Some(1) =>
1416
val t = asInstanceOf[Tuple1[Object]]
1517
Array(t._1)
@@ -22,12 +24,12 @@ sealed trait Tuple extends Any {
2224
case Some(4) =>
2325
val t = asInstanceOf[Tuple4[Object, Object, Object, Object]]
2426
Array(t._1, t._2, t._3, t._4)
25-
case Some(n) if n <= scala.runtime.DynamicTuple.MaxSpecialized =>
26-
to$Array(this, n)
27+
case Some(n) if n <= DynamicTuple.MaxSpecialized =>
28+
DynamicTuple.to$Array(this, n)
2729
case Some(n) =>
2830
asInstanceOf[TupleXXL].elems
2931
case None =>
30-
runtime.DynamicTuple.dynamicToArray(this)
32+
DynamicTuple.dynamicToArray(this)
3133
}
3234

3335
inline def *: [H, This >: this.type <: Tuple] (x: H): H *: This = {
@@ -47,9 +49,9 @@ sealed trait Tuple extends Any {
4749
val t = asInstanceOf[Tuple4[_, _, _, _]]
4850
Tuple5(x, t._1, t._2, t._3, t._4).asInstanceOf[Result]
4951
case Some(n) =>
50-
knownTupleFromArray[H *: this.type](cons$Array(x, toArray))
52+
knownTupleFromArray[H *: this.type](DynamicTuple.cons$Array(x, toArray))
5153
case _ =>
52-
runtime.DynamicTuple.dynamic_*:[This, H](this, x)
54+
DynamicTuple.dynamic_*:[This, H](this, x)
5355
}
5456
}
5557

@@ -72,7 +74,7 @@ sealed trait Tuple extends Any {
7274
val u = that.asInstanceOf[Tuple2[_, _]]
7375
Tuple4(t._1, t._2, u._1, u._2).asInstanceOf[Result]
7476
case _ =>
75-
genericConcat[Result](this, that).asInstanceOf[Result]
77+
knownTupleFromArray[Result](this.toArray ++ that.toArray)
7678
}
7779
case Some(3) =>
7880
val t = asInstanceOf[Tuple3[_, _, _]]
@@ -82,24 +84,21 @@ sealed trait Tuple extends Any {
8284
val u = that.asInstanceOf[Tuple1[_]]
8385
Tuple4(t._1, t._2, t._3, u._1).asInstanceOf[Result]
8486
case _ =>
85-
genericConcat[Result](this, that).asInstanceOf[Result]
87+
knownTupleFromArray[Result](this.toArray ++ that.toArray)
8688
}
8789
case Some(_) =>
8890
if (constValue[BoundedSize[that.type]] == 0) this.asInstanceOf[Result]
89-
else genericConcat[Result](this, that).asInstanceOf[Result]
91+
else knownTupleFromArray[Result](this.toArray ++ that.toArray)
9092
case None =>
91-
runtime.DynamicTuple.dynamic_++[This, that.type](this, that)
93+
DynamicTuple.dynamic_++[This, that.type](this, that)
9294
}
9395
}
9496

95-
inline def genericConcat[T <: Tuple](xs: Tuple, ys: Tuple): Tuple =
96-
knownTupleFromArray[T](xs.toArray ++ ys.toArray)
97-
9897
inline def size[This >: this.type <: Tuple]: Size[This] = {
9998
type Result = Size[This]
10099
inline constValueOpt[BoundedSize[this.type]] match {
101100
case Some(n) => n.asInstanceOf[Result]
102-
case _ => runtime.DynamicTuple.dynamicSize(this)
101+
case _ => DynamicTuple.dynamicSize(this)
103102
}
104103
}
105104

@@ -144,25 +143,7 @@ object Tuple {
144143

145144
private[scala] type BoundedSize[X] = BoundedSizeRecur[X, 23]
146145

147-
val $emptyArray = Array[Object]()
148-
149-
def to$Array(xs: Tuple, n: Int) = {
150-
val arr = new Array[Object](n)
151-
var i = 0
152-
var it = xs.asInstanceOf[Product].productIterator
153-
while (i < n) {
154-
arr(i) = it.next().asInstanceOf[Object]
155-
i += 1
156-
}
157-
arr
158-
}
159-
160-
def cons$Array[H](x: H, elems: Array[Object]): Array[Object] = {
161-
val elems1 = new Array[Object](elems.length + 1)
162-
elems1(0) = x.asInstanceOf[Object]
163-
System.arraycopy(elems, 0, elems1, 1, elems.length)
164-
elems1
165-
}
146+
private[scala] val $emptyArray = Array[Object]()
166147

167148
private[scala] inline def knownTupleFromArray[T <: Tuple](xs: Array[Object]): T =
168149
inline constValue[BoundedSize[T]] match {
@@ -197,7 +178,7 @@ object Tuple {
197178
case xs: Array[Object] => xs
198179
case xs => xs.map(_.asInstanceOf[Object])
199180
}
200-
runtime.DynamicTuple.dynamicFromArray[Tuple](xs2)
181+
DynamicTuple.dynamicFromArray[Tuple](xs2)
201182
}
202183

203184
def fromProduct(product: Product): Tuple =
@@ -223,13 +204,13 @@ sealed trait NonEmptyTuple extends Tuple {
223204
case Some(4) =>
224205
val t = asInstanceOf[Tuple4[_, _, _, _]]
225206
t._1
226-
case Some(n) if n > 4 && n <= scala.runtime.DynamicTuple.MaxSpecialized =>
207+
case Some(n) if n > 4 && n <= DynamicTuple.MaxSpecialized =>
227208
asInstanceOf[Product].productElement(0)
228-
case Some(n) if n > scala.runtime.DynamicTuple.MaxSpecialized =>
209+
case Some(n) if n > DynamicTuple.MaxSpecialized =>
229210
val t = asInstanceOf[TupleXXL]
230211
t.elems(0)
231212
case None =>
232-
scala.runtime.DynamicTuple.dynamicHead[this.type](this)
213+
DynamicTuple.dynamicHead[this.type](this)
233214
}
234215
resVal.asInstanceOf[Result]
235216
}
@@ -254,14 +235,14 @@ sealed trait NonEmptyTuple extends Tuple {
254235
case Some(n) if n > 5 =>
255236
knownTupleFromArray[Result](toArray.tail)
256237
case None =>
257-
runtime.DynamicTuple.dynamicTail[This](this)
238+
DynamicTuple.dynamicTail[This](this)
258239
}
259240
}
260241

261242
inline def fallbackApply(n: Int) =
262243
inline constValueOpt[n.type] match {
263244
case Some(n: Int) => error("index out of bounds: ", n)
264-
case None => runtime.DynamicTuple.dynamicApply[this.type, n.type](this, n)
245+
case None => DynamicTuple.dynamicApply[this.type, n.type](this, n)
265246
}
266247

267248
inline def apply[This >: this.type <: NonEmptyTuple](n: Int): Elem[This, n.type] = {
@@ -297,13 +278,13 @@ sealed trait NonEmptyTuple extends Tuple {
297278
case Some(3) => t._4.asInstanceOf[Result]
298279
case _ => fallbackApply(n).asInstanceOf[Result]
299280
}
300-
case Some(s) if s > 4 && s <= scala.runtime.DynamicTuple.MaxSpecialized =>
281+
case Some(s) if s > 4 && s <= DynamicTuple.MaxSpecialized =>
301282
val t = asInstanceOf[Product]
302283
inline constValueOpt[n.type] match {
303284
case Some(n) if n >= 0 && n < s => t.productElement(n).asInstanceOf[Result]
304285
case _ => fallbackApply(n).asInstanceOf[Result]
305286
}
306-
case Some(s) if s > scala.runtime.DynamicTuple.MaxSpecialized =>
287+
case Some(s) if s > DynamicTuple.MaxSpecialized =>
307288
val t = asInstanceOf[TupleXXL]
308289
inline constValueOpt[n.type] match {
309290
case Some(n) if n >= 0 && n < s => t.elems(n).asInstanceOf[Result]
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
import scala.reflect.ClassTag
2+
3+
object Test {
4+
def main(args: Array[String]): Unit = {
5+
6+
assert(1 == Tuple1(1).apply(0))
7+
assert(1 == (1, 2).apply(0))
8+
assert(2 == (1, 2).apply(1))
9+
assert(1 == (1, 2, 3).apply(0))
10+
assert(2 == (1, 2, 3).apply(1))
11+
assert(3 == (1, 2, 3).apply(2))
12+
assert(1 == (1, 2, 3, 4).apply(0))
13+
assert(2 == (1, 2, 3, 4).apply(1))
14+
assert(3 == (1, 2, 3, 4).apply(2))
15+
assert(4 == (1, 2, 3, 4).apply(3))
16+
assert(1 == (1, 2, 3, 4, 5).apply(0))
17+
assert(2 == (1, 2, 3, 4, 5).apply(1))
18+
assert(3 == (1, 2, 3, 4, 5).apply(2))
19+
assert(4 == (1, 2, 3, 4, 5).apply(3))
20+
assert(5 == (1, 2, 3, 4, 5).apply(4))
21+
// TODO improve performace
22+
// assert(1 == (1, 2, 3, 4, 5, 6).apply(0))
23+
// assert(2 == (1, 2, 3, 4, 5, 6).apply(1))
24+
// assert(3 == (1, 2, 3, 4, 5, 6).apply(2))
25+
// assert(4 == (1, 2, 3, 4, 5, 6).apply(3))
26+
// assert(5 == (1, 2, 3, 4, 5, 6).apply(4))
27+
// assert(6 == (1, 2, 3, 4, 5, 6).apply(5))
28+
// assert(1 == (1, 2, 3, 4, 5, 6, 7).apply(0))
29+
// assert(2 == (1, 2, 3, 4, 5, 6, 7).apply(1))
30+
// assert(3 == (1, 2, 3, 4, 5, 6, 7).apply(2))
31+
// assert(4 == (1, 2, 3, 4, 5, 6, 7).apply(3))
32+
// assert(5 == (1, 2, 3, 4, 5, 6, 7).apply(4))
33+
// assert(6 == (1, 2, 3, 4, 5, 6, 7).apply(5))
34+
// assert(7 == (1, 2, 3, 4, 5, 6, 7).apply(6))
35+
// assert(1 == (1, 2, 3, 4, 5, 6, 7, 8).apply(0))
36+
// assert(2 == (1, 2, 3, 4, 5, 6, 7, 8).apply(1))
37+
// assert(3 == (1, 2, 3, 4, 5, 6, 7, 8).apply(2))
38+
// assert(4 == (1, 2, 3, 4, 5, 6, 7, 8).apply(3))
39+
// assert(5 == (1, 2, 3, 4, 5, 6, 7, 8).apply(4))
40+
// assert(6 == (1, 2, 3, 4, 5, 6, 7, 8).apply(5))
41+
// assert(7 == (1, 2, 3, 4, 5, 6, 7, 8).apply(6))
42+
// assert(8 == (1, 2, 3, 4, 5, 6, 7, 8).apply(7))
43+
// assert(1 == (1, 2, 3, 4, 5, 6, 7, 8, 9).apply(0))
44+
// assert(2 == (1, 2, 3, 4, 5, 6, 7, 8, 9).apply(1))
45+
// assert(3 == (1, 2, 3, 4, 5, 6, 7, 8, 9).apply(2))
46+
// assert(4 == (1, 2, 3, 4, 5, 6, 7, 8, 9).apply(3))
47+
// assert(5 == (1, 2, 3, 4, 5, 6, 7, 8, 9).apply(4))
48+
// assert(6 == (1, 2, 3, 4, 5, 6, 7, 8, 9).apply(5))
49+
// assert(7 == (1, 2, 3, 4, 5, 6, 7, 8, 9).apply(6))
50+
// assert(8 == (1, 2, 3, 4, 5, 6, 7, 8, 9).apply(7))
51+
// assert(9 == (1, 2, 3, 4, 5, 6, 7, 8, 9).apply(8))
52+
// assert(1 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10).apply(0))
53+
// assert(2 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10).apply(1))
54+
// assert(3 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10).apply(2))
55+
// assert(4 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10).apply(3))
56+
// assert(5 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10).apply(4))
57+
// assert(6 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10).apply(5))
58+
// assert(7 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10).apply(6))
59+
// assert(8 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10).apply(7))
60+
// assert(9 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10).apply(8))
61+
// assert(10 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10).apply(9))
62+
63+
assert(1 == Tuple1(1).apply(0))
64+
assert(1 == (1, 2).apply(0))
65+
assert(1 == (1, 2, 3).apply(0))
66+
assert(1 == (1, 2, 3, 4).apply(0))
67+
assert(1 == (1, 2, 3, 4, 5).apply(0))
68+
assert(1 == (1, 2, 3, 4, 5, 6).apply(0))
69+
assert(1 == (1, 2, 3, 4, 5, 6, 7).apply(0))
70+
assert(1 == (1, 2, 3, 4, 5, 6, 7, 8).apply(0))
71+
assert(1 == (1, 2, 3, 4, 5, 6, 7, 8, 9).apply(0))
72+
assert(1 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10).apply(0))
73+
assert(1 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11).apply(0))
74+
assert(1 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).apply(0))
75+
assert(1 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).apply(0))
76+
assert(1 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).apply(0))
77+
assert(1 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).apply(0))
78+
assert(1 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16).apply(0))
79+
assert(1 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17).apply(0))
80+
assert(1 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18).apply(0))
81+
assert(1 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19).apply(0))
82+
assert(1 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20).apply(0))
83+
assert(1 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21).apply(0))
84+
assert(1 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22).apply(0))
85+
assert(1 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23).apply(0))
86+
assert(1 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24).apply(0))
87+
assert(1 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25).apply(0))
88+
89+
assert(1 == Tuple1(1).apply(0))
90+
assert(2 == (1, 2).apply(1))
91+
assert(3 == (1, 2, 3).apply(2))
92+
assert(4 == (1, 2, 3, 4).apply(3))
93+
assert(5 == (1, 2, 3, 4, 5).apply(4))
94+
assert(6 == (1, 2, 3, 4, 5, 6).apply(5))
95+
assert(7 == (1, 2, 3, 4, 5, 6, 7).apply(6))
96+
assert(8 == (1, 2, 3, 4, 5, 6, 7, 8).apply(7))
97+
assert(9 == (1, 2, 3, 4, 5, 6, 7, 8, 9).apply(8))
98+
assert(10 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10).apply(9))
99+
assert(11 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11).apply(10))
100+
assert(12 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).apply(11))
101+
assert(13 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).apply(12))
102+
assert(14 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).apply(13))
103+
assert(15 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).apply(14))
104+
assert(16 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16).apply(15))
105+
assert(17 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17).apply(16))
106+
assert(18 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18).apply(17))
107+
assert(19 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19).apply(18))
108+
assert(20 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20).apply(19))
109+
assert(21 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21).apply(20))
110+
assert(22 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22).apply(21))
111+
assert(23 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23).apply(22))
112+
assert(24 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24).apply(23))
113+
assert(25 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25).apply(24))
114+
115+
assert(1 == (1 *: ()).apply(0))
116+
assert(1 == (1 *: 2 *: ()).apply(0))
117+
assert(1 == (1 *: 2 *: 3 *: ()).apply(0))
118+
assert(1 == (1 *: 2 *: 3 *: 4 *: ()).apply(0))
119+
assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: ()).apply(0))
120+
assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: ()).apply(0))
121+
assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: ()).apply(0))
122+
// FIXME performace
123+
// assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: ()).apply(0))
124+
// assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: ()).apply(0))
125+
// assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: ()).apply(0))
126+
// assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: ()).apply(0))
127+
// assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: ()).apply(0))
128+
// assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: ()).apply(0))
129+
// assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: ()).apply(0))
130+
// assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: ()).apply(0))
131+
// assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: 16 *: ()).apply(0))
132+
// assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: 16 *: 17 *: ()).apply(0))
133+
// assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: 16 *: 17 *: 18 *: ()).apply(0))
134+
// assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: 16 *: 17 *: 18 *: 19 *: ()).apply(0))
135+
// assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: 16 *: 17 *: 18 *: 19 *: 20 *: ()).apply(0))
136+
// assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: 16 *: 17 *: 18 *: 19 *: 20 *: 21 *: ()).apply(0))
137+
// assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: 16 *: 17 *: 18 *: 19 *: 20 *: 21 *: 22 *: ()).apply(0))
138+
// assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: 16 *: 17 *: 18 *: 19 *: 20 *: 21 *: 22 *: 23 *: ()).apply(0))
139+
// assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: 16 *: 17 *: 18 *: 19 *: 20 *: 21 *: 22 *: 23 *: 24 *: ()).apply(0))
140+
// assert(1 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: 16 *: 17 *: 18 *: 19 *: 20 *: 21 *: 22 *: 23 *: 24 *: 25 *: ()).apply(0))
141+
142+
assert(1 == (1 *: ()).apply(0))
143+
assert(2 == (1 *: 2 *: ()).apply(1))
144+
assert(3 == (1 *: 2 *: 3 *: ()).apply(2))
145+
assert(4 == (1 *: 2 *: 3 *: 4 *: ()).apply(3))
146+
assert(5 == (1 *: 2 *: 3 *: 4 *: 5 *: ()).apply(4))
147+
assert(6 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: ()).apply(5))
148+
assert(7 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: ()).apply(6))
149+
// FIXME performace
150+
// assert(8 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: ()).apply(7))
151+
// assert(9 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: ()).apply(8))
152+
// assert(10 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: ()).apply(9))
153+
// assert(11 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: ()).apply(10))
154+
// assert(12 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: ()).apply(11))
155+
// assert(13 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: ()).apply(12))
156+
// assert(14 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: ()).apply(13))
157+
// assert(15 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: ()).apply(14))
158+
// assert(16 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: 16 *: ()).apply(15))
159+
// assert(17 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: 16 *: 17 *: ()).apply(16))
160+
// assert(18 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: 16 *: 17 *: 18 *: ()).apply(17))
161+
// assert(19 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: 16 *: 17 *: 18 *: 19 *: ()).apply(18))
162+
// assert(20 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: 16 *: 17 *: 18 *: 19 *: 20 *: ()).apply(19))
163+
// assert(21 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: 16 *: 17 *: 18 *: 19 *: 20 *: 21 *: ()).apply(20))
164+
// assert(22 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: 16 *: 17 *: 18 *: 19 *: 20 *: 21 *: 22 *: ()).apply(21))
165+
// assert(23 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: 16 *: 17 *: 18 *: 19 *: 20 *: 21 *: 22 *: 23 *: ()).apply(22))
166+
// assert(24 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: 16 *: 17 *: 18 *: 19 *: 20 *: 21 *: 22 *: 23 *: 24 *: ()).apply(23))
167+
// assert(25 == (1 *: 2 *: 3 *: 4 *: 5 *: 6 *: 7 *: 8 *: 9 *: 10 *: 11 *: 12 *: 13 *: 14 *: 15 *: 16 *: 17 *: 18 *: 19 *: 20 *: 21 *: 22 *: 23 *: 24 *: 25 *: ()).apply(24))
168+
169+
}
170+
}

0 commit comments

Comments
 (0)