@@ -28,7 +28,6 @@ import ValueClasses._
28
28
import TypeUtils ._
29
29
import ExplicitOuter ._
30
30
import core .Mode
31
- import core .PhantomErasure
32
31
import reporting .trace
33
32
34
33
class Erasure extends Phase with DenotTransformer {
@@ -213,8 +212,6 @@ object Erasure {
213
212
val tree1 =
214
213
if (tree.tpe isRef defn.NullClass )
215
214
adaptToType(tree, underlying)
216
- else if (wasPhantom(underlying))
217
- PhantomErasure .erasedParameterRef
218
215
else if (! (tree.tpe <:< tycon)) {
219
216
assert(! (tree.tpe.typeSymbol.isPrimitiveValueClass))
220
217
val nullTree = Literal (Constant (null ))
@@ -437,16 +434,9 @@ object Erasure {
437
434
}
438
435
}
439
436
440
- if ((origSym eq defn.Phantom_assume ) || (origSym.is(Flags .ParamAccessor ) && wasPhantom(pt)))
441
- PhantomErasure .erasedAssume
442
- else recur(typed(tree.qualifier, AnySelectionProto ))
437
+ recur(typed(tree.qualifier, AnySelectionProto ))
443
438
}
444
439
445
- override def typedIdent (tree : untpd.Ident , pt : Type )(implicit ctx : Context ): tpd.Tree =
446
- if (tree.symbol eq defn.Phantom_assume ) PhantomErasure .erasedAssume
447
- else if (tree.symbol.is(Flags .Param ) && wasPhantom(tree.typeOpt)) PhantomErasure .erasedParameterRef
448
- else super .typedIdent(tree, pt)
449
-
450
440
override def typedThis (tree : untpd.This )(implicit ctx : Context ): Tree =
451
441
if (tree.symbol == ctx.owner.lexicallyEnclosingClass || tree.symbol.isStaticOwner) promote(tree)
452
442
else {
@@ -507,11 +497,9 @@ object Erasure {
507
497
.withType(defn.ArrayOf (defn.ObjectType ))
508
498
args0 = bunchedArgs :: Nil
509
499
}
510
- // Arguments are phantom if an only if the parameters are phantom, guaranteed by the separation of type lattices
511
- val args1 = args0.filterConserve(arg => ! wasPhantom(arg.typeOpt))
512
- assert(args1 hasSameLengthAs mt.paramInfos)
513
- val args2 = args1.zipWithConserve(mt.paramInfos)(typedExpr)
514
- untpd.cpy.Apply (tree)(fun1, args2) withType mt.resultType
500
+ assert(args0 hasSameLengthAs mt.paramInfos)
501
+ val args1 = args0.zipWithConserve(mt.paramInfos)(typedExpr)
502
+ untpd.cpy.Apply (tree)(fun1, args1) withType mt.resultType
515
503
case _ =>
516
504
throw new MatchError (i " tree $tree has unexpected type of function ${fun1.tpe.widen}, was ${fun.typeOpt.widen}" )
517
505
}
@@ -572,11 +560,6 @@ object Erasure {
572
560
rhs1 = untpd.Block (paramDefs, rhs1)
573
561
}
574
562
vparamss1 = vparamss1.mapConserve(_.filterConserve(! _.symbol.is(Flags .Unused )))
575
- vparamss1 = vparamss1.mapConserve(_.filterConserve(vparam => ! wasPhantom(vparam.tpe)))
576
- if (sym.is(Flags .ParamAccessor ) && wasPhantom(ddef.tpt.tpe)) {
577
- sym.resetFlag(Flags .ParamAccessor )
578
- rhs1 = PhantomErasure .erasedParameterRef
579
- }
580
563
val ddef1 = untpd.cpy.DefDef (ddef)(
581
564
tparams = Nil ,
582
565
vparamss = vparamss1,
@@ -703,7 +686,4 @@ object Erasure {
703
686
704
687
def takesBridges (sym : Symbol )(implicit ctx : Context ) =
705
688
sym.isClass && ! sym.is(Flags .Trait | Flags .Package )
706
-
707
- private def wasPhantom (tp : Type )(implicit ctx : Context ): Boolean =
708
- tp.widenDealias.classSymbol eq defn.ErasedPhantomClass
709
689
}
0 commit comments