@@ -67,7 +67,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
67
67
emptyEnv ++ (sym.info.typeParams zip args filter (kv => isSpecialized(kv._1)))
68
68
}
69
69
70
- /** Is typeenv `t1` included in `t2`? All type variables in `t1`
70
+ /** Does typeenv `t1` include `t2`? All type variables in `t1`
71
71
* are defined in `t2` and:
72
72
* - are bound to the same type, or
73
73
* - are an AnyRef specialization and `t2` is bound to a subtype of AnyRef
@@ -150,6 +150,11 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
150
150
def target = t
151
151
}
152
152
153
+ /** Symbol is a specialized abstract method, either specialized or original. The original `t` is abstract. */
154
+ case class Abstract (t : Symbol ) extends SpecializedInfo {
155
+ def target = t
156
+ }
157
+
153
158
/** Symbol is a specialized accessor for the `target` field. */
154
159
case class SpecializedAccessor (target : Symbol ) extends SpecializedInfo {
155
160
override def isAccessor = true
@@ -301,7 +306,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
301
306
loop(keys map concreteTypes) map (keys zip _ toMap)
302
307
}
303
308
304
- /** Does the given tpe need to be specialized in the environment 'env'?
309
+ /** Does the given 'sym' need to be specialized in the environment 'env'?
305
310
* Specialization is needed for
306
311
* - members with specialized type parameters found in the given environment
307
312
* - constructors of specialized classes
@@ -587,13 +592,13 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
587
592
log(" conflicting env for " + m + " env: " + env)
588
593
}
589
594
else if (m.isDeferred) { // abstract methods
590
- val specMember = enterMember(m.cloneSymbol(cls)).setFlag(SPECIALIZED ).resetFlag(DEFERRED )
591
- debuglog(" deferred " + specMember.fullName + " is forwarded" )
592
-
593
- info(specMember) = new Forward (specMember) {
594
- override def target = m.owner.info.member(specializedName(m, env))
595
- }
595
+ val specMember = enterMember(m.cloneSymbol(cls)).setFlag(SPECIALIZED ).setFlag(DEFERRED )
596
+ debuglog(" deferred " + specMember.fullName + " remains abstract" )
596
597
598
+ info(specMember) = new Abstract (specMember)
599
+ // was: new Forward(specMember) {
600
+ // override def target = m.owner.info.member(specializedName(m, env))
601
+ // }
597
602
} else if (m.isMethod && ! m.hasAccessorFlag) { // other concrete methods
598
603
// log("other concrete " + m)
599
604
forwardToOverload(m)
@@ -812,15 +817,15 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
812
817
)
813
818
}
814
819
815
- /** For each method m that overrides inherited method m', add a special
820
+ /** For each method m that overrides an inherited method m', add a special
816
821
* overload method `om` that overrides the corresponding overload in the
817
822
* superclass. For the following example:
818
823
*
819
824
* class IntFun extends Function1[Int, Int] {
820
- * def apply(x: Int): Int = ..
825
+ * def apply(x: Int): Int = ..
821
826
* }
822
827
*
823
- * this method will return List('apply$spec$II ')
828
+ * this method will return List('apply$mcII$sp ')
824
829
*/
825
830
private def specialOverrides (clazz : Symbol ): List [Symbol ] = {
826
831
/** Return the overridden symbol in syms that needs a specialized overriding symbol,
@@ -1431,6 +1436,12 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
1431
1436
Assign (gen.mkAttributedRef(target), Ident (vparamss.head.head.symbol))
1432
1437
log(" specialized accessor: " + target + " -> " + rhs1)
1433
1438
localTyper.typed(treeCopy.DefDef (tree, mods, name, tparams, vparamss, tpt, rhs1))
1439
+
1440
+ case Abstract (targ) =>
1441
+ log(" abstract: " + targ)
1442
+ val DefDef (mods, name, tparams, vparamss, tpt, rhs) = tree
1443
+ val t = treeCopy.DefDef (tree, mods, name, tparams, vparamss, tpt, rhs)
1444
+ localTyper.typed(t)
1434
1445
}
1435
1446
1436
1447
case ValDef (mods, name, tpt, rhs) if symbol.hasFlag(SPECIALIZED ) && ! symbol.isParamAccessor =>
0 commit comments