@@ -939,7 +939,8 @@ class Definitions {
939
939
def scalaClassName (ref : Type )(implicit ctx : Context ): TypeName = scalaClassName(ref.classSymbol)
940
940
941
941
private def isVarArityClass (cls : Symbol , prefix : String ) =
942
- scalaClassName(cls).testSimple(name =>
942
+ cls.isClass && cls.owner.eq(ScalaPackageClass ) &&
943
+ cls.name.testSimple(name =>
943
944
name.startsWith(prefix) &&
944
945
name.length > prefix.length &&
945
946
name.drop(prefix.length).forall(_.isDigit))
@@ -1159,6 +1160,14 @@ class Definitions {
1159
1160
def isAssuredNoInits (sym : Symbol ) =
1160
1161
(sym `eq` SomeClass ) || isTupleClass(sym)
1161
1162
1163
+ /** If `cls` is Tuple1..Tuple22, add the corresponding *: type as last parent to `parents` */
1164
+ def adjustForTuple (cls : ClassSymbol , tparams : List [TypeSymbol ], parents : List [Type ]): List [Type ] = {
1165
+ def syntheticParent (tparams : List [TypeSymbol ]): Type =
1166
+ if (tparams.isEmpty) TupleTypeRef
1167
+ else (tparams :\ (UnitType : Type )) ((tparam, tail) => PairType .appliedTo(tparam.typeRef, tail))
1168
+ if (isTupleClass(cls) || cls == UnitClass ) parents :+ syntheticParent(tparams) else parents
1169
+ }
1170
+
1162
1171
// ----- primitive value class machinery ------------------------------------------
1163
1172
1164
1173
/** This class would also be obviated by the implicit function type design */
@@ -1260,27 +1269,6 @@ class Definitions {
1260
1269
1261
1270
private [this ] var isInitialized = false
1262
1271
1263
- /** Add a `Tuple` as a parent to `Unit`.
1264
- * Add the right `*:` instance as a parent to Tuple1..Tuple22
1265
- */
1266
- def fixTupleCompleter (cls : ClassSymbol ): Unit = cls.infoOrCompleter match {
1267
- case completer : LazyType =>
1268
- cls.info = new LazyType {
1269
- def syntheticParent (tparams : List [TypeSymbol ]): Type =
1270
- if (tparams.isEmpty) TupleTypeRef
1271
- else (tparams :\ (UnitType : Type )) ((tparam, tail) => PairType .appliedTo(tparam.typeRef, tail))
1272
- override def complete (denot : SymDenotation )(implicit ctx : Context ) = {
1273
- completer.complete(denot)
1274
- denot.info match {
1275
- case info : ClassInfo =>
1276
- denot.info = info.derivedClassInfo(
1277
- classParents = info.classParents :+ syntheticParent(cls.typeParams))
1278
- }
1279
- }
1280
- }
1281
- case _ =>
1282
- }
1283
-
1284
1272
def init ()(implicit ctx : Context ) = {
1285
1273
this .ctx = ctx
1286
1274
if (! isInitialized) {
@@ -1298,10 +1286,6 @@ class Definitions {
1298
1286
// force initialization of every symbol that is synthesized or hijacked by the compiler
1299
1287
val forced = syntheticCoreClasses ++ syntheticCoreMethods ++ ScalaValueClasses ()
1300
1288
1301
- fixTupleCompleter(UnitClass )
1302
- for (i <- 1 to MaxTupleArity )
1303
- fixTupleCompleter(TupleType (i).symbol.asClass)
1304
-
1305
1289
isInitialized = true
1306
1290
}
1307
1291
}
0 commit comments