@@ -24,13 +24,13 @@ class TupleOptimizations extends MiniPhase with IdentityDenotTransformer {
24
24
def phaseName : String = " genericTuples"
25
25
26
26
override def transformApply (tree : tpd.Apply )(using Context ): tpd.Tree =
27
- if (! tree.symbol.exists || tree.symbol.owner != defn.RuntimeTupleModuleClass ) tree
28
- else if (tree.symbol == defn.RuntimeTuple_cons ) transformTupleCons(tree)
29
- else if (tree.symbol == defn.RuntimeTuple_tail ) transformTupleTail(tree)
30
- else if (tree.symbol == defn.RuntimeTuple_size ) transformTupleSize(tree)
31
- else if (tree.symbol == defn.RuntimeTuple_concat ) transformTupleConcat(tree)
32
- else if (tree.symbol == defn.RuntimeTuple_apply ) transformTupleApply(tree)
33
- else if (tree.symbol == defn.RuntimeTuple_toArray ) transformTupleToArray(tree)
27
+ if (! tree.symbol.exists || tree.symbol.owner != defn.RuntimeTuplesModuleClass ) tree
28
+ else if (tree.symbol == defn.RuntimeTuples_cons ) transformTupleCons(tree)
29
+ else if (tree.symbol == defn.RuntimeTuples_tail ) transformTupleTail(tree)
30
+ else if (tree.symbol == defn.RuntimeTuples_size ) transformTupleSize(tree)
31
+ else if (tree.symbol == defn.RuntimeTuples_concat ) transformTupleConcat(tree)
32
+ else if (tree.symbol == defn.RuntimeTuples_apply ) transformTupleApply(tree)
33
+ else if (tree.symbol == defn.RuntimeTuples_toArray ) transformTupleToArray(tree)
34
34
else tree
35
35
36
36
private def transformTupleCons (tree : tpd.Apply )(using Context ): Tree = {
@@ -49,14 +49,14 @@ class TupleOptimizations extends MiniPhase with IdentityDenotTransformer {
49
49
else {
50
50
// val it = Iterator.single(head) ++ tail.asInstanceOf[Product].productIterator
51
51
// TupleN+1(it.next(), ..., it.next())
52
- val fullIterator = ref(defn.RuntimeTuple_consIterator ).appliedToArgs(head :: tail :: Nil )
52
+ val fullIterator = ref(defn.RuntimeTuples_consIterator ).appliedToArgs(head :: tail :: Nil )
53
53
evalOnce(fullIterator) { it =>
54
54
knownTupleFromIterator(tpes.length, it).asInstance(tree.tpe)
55
55
}
56
56
}
57
57
case _ =>
58
58
// No optimization, keep:
59
- // scala.runtime.Tuple .cons(tail, head)
59
+ // scala.runtime.Tuples .cons(tail, head)
60
60
tree
61
61
}
62
62
}
@@ -93,7 +93,7 @@ class TupleOptimizations extends MiniPhase with IdentityDenotTransformer {
93
93
tup.asInstance(defn.TupleXXLClass .typeRef).select(" tailXXL" .toTermName)
94
94
case None =>
95
95
// No optimization, keep:
96
- // scala.runtime.Tuple .tail(tup)
96
+ // scala.runtime.Tuples .tail(tup)
97
97
tree
98
98
}
99
99
}
@@ -127,14 +127,14 @@ class TupleOptimizations extends MiniPhase with IdentityDenotTransformer {
127
127
else {
128
128
// val it = self.asInstanceOf[Product].productIterator ++ that.asInstanceOf[Product].productIterator
129
129
// TupleN+M(it.next(), ..., it.next())
130
- val fullIterator = ref(defn.RuntimeTuple_concatIterator ).appliedToArgs(tree.args)
130
+ val fullIterator = ref(defn.RuntimeTuples_concatIterator ).appliedToArgs(tree.args)
131
131
evalOnce(fullIterator) { it =>
132
132
knownTupleFromIterator(n + m, it).asInstance(tree.tpe)
133
133
}
134
134
}
135
135
case _ =>
136
136
// No optimization, keep:
137
- // scala.runtime.Tuple .cons(self, that)
137
+ // scala.runtime.Tuples .cons(self, that)
138
138
tree
139
139
}
140
140
}
@@ -161,7 +161,7 @@ class TupleOptimizations extends MiniPhase with IdentityDenotTransformer {
161
161
tree
162
162
case _ =>
163
163
// No optimization, keep:
164
- // scala.runtime.Tuple .apply(tup, n)
164
+ // scala.runtime.Tuples .apply(tup, n)
165
165
tree
166
166
}
167
167
}
@@ -175,14 +175,14 @@ class TupleOptimizations extends MiniPhase with IdentityDenotTransformer {
175
175
// Array.emptyObjectArray
176
176
ref(defn.ArrayModule ).select(" emptyObjectArray" .toTermName).ensureApplied
177
177
else if (size <= MaxTupleArity )
178
- // scala.runtime.Tuple .productToArray(tup.asInstanceOf[Product])
179
- ref(defn.RuntimeTuple_productToArray ).appliedTo(tup.asInstance(defn.ProductClass .typeRef))
178
+ // scala.runtime.Tuples .productToArray(tup.asInstanceOf[Product])
179
+ ref(defn.RuntimeTuples_productToArray ).appliedTo(tup.asInstance(defn.ProductClass .typeRef))
180
180
else
181
181
// tup.asInstanceOf[TupleXXL].elems.clone()
182
182
tup.asInstance(defn.TupleXXLClass .typeRef).select(nme.toArray)
183
183
case None =>
184
184
// No optimization, keep:
185
- // scala.runtime.Tuple .toArray(tup)
185
+ // scala.runtime.Tuples .toArray(tup)
186
186
tree
187
187
}
188
188
}
0 commit comments