File tree 3 files changed +16
-9
lines changed
compiler/src/dotty/tools/dotc/transform
library/src-bootstrapped/scala 3 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -5,10 +5,10 @@ class Foo {
5
5
// 36.169 ±(99.9%) 0.655 ms/op [Average]
6
6
7
7
8
- Tuple2 (1 , 2 ).tail
8
+ // Tuple2(1, 2).tail
9
9
// 419.855 ±(99.9%) 44.090 ms/op [Average]
10
10
// 254.921 ±(99.9%) 3.946 ms/op [Average]
11
11
// 237.878 ±(99.9%) 2.846 ms/op [Average]
12
12
13
- // (21 *: 22 *: ())
13
+ (21 *: 22 *: ())
14
14
}
Original file line number Diff line number Diff line change @@ -30,10 +30,10 @@ class GenericTuples extends MiniPhase with IdentityDenotTransformer {
30
30
else super .transformApply(tree)
31
31
}
32
32
33
- override def transformTypeApply (tree : tpd.TypeApply )(implicit ctx : Context ): tpd.Tree = {
34
- if (tree.symbol == defn.NonEmptyTuple_tail ) transformTupleTail(tree)
35
- else super .transformTypeApply(tree)
36
- }
33
+ // override def transformTypeApply(tree: tpd.TypeApply)(implicit ctx: Context): tpd.Tree = {
34
+ // if (tree.symbol == defn.NonEmptyTuple_tail) transformTupleTail(tree)
35
+ // else super.transformTypeApply(tree)
36
+ // }
37
37
38
38
private def transformTupleCons (tree : tpd.Apply )(implicit ctx : Context ): Tree = {
39
39
val TypeApply (Select (qual, _), headType :: tailType :: Nil ) = tree.fun
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ sealed trait Tuple extends Any {
32
32
DynamicTuple .dynamicToArray(this )
33
33
}
34
34
35
- def *: [H , This >: this .type <: Tuple ] (x : H ): H *: This = ???
35
+ def *: [H , This >: this .type <: Tuple ] (x : H ): H *: This
36
36
37
37
inline def ++ [This >: this .type <: Tuple ](that : Tuple ): Concat [This , that.type ] = {
38
38
type Result = Concat [This , that.type ]
@@ -194,8 +194,6 @@ sealed trait NonEmptyTuple extends Tuple {
194
194
resVal.asInstanceOf [Result ]
195
195
}
196
196
197
- def tail [This >: this .type <: NonEmptyTuple ]: Tail [This ]
198
-
199
197
inline def fallbackApply (n : Int ) =
200
198
inline constValueOpt[n.type ] match {
201
199
case Some (n : Int ) => error(" index out of bounds: " , n)
@@ -253,6 +251,15 @@ sealed trait NonEmptyTuple extends Tuple {
253
251
254
252
}
255
253
254
+ object NonEmptyTuple {
255
+ import Tuple ._
256
+ implicit class NonEmptyTupleOps [This <: NonEmptyTuple ](val self : This ) {
257
+ inline def tail : Tail [This ] =
258
+ scala.runtime.DynamicTuple .dynamicTail[This ](self)
259
+ }
260
+
261
+ }
262
+
256
263
@ showAsInfix
257
264
sealed abstract class *: [+ H , + T <: Tuple ] extends NonEmptyTuple
258
265
You can’t perform that action at this time.
0 commit comments