@@ -28,7 +28,6 @@ import ValueClasses._
2828import TypeUtils ._
2929import ExplicitOuter ._
3030import core .Mode
31- import core .PhantomErasure
3231import reporting .trace
3332
3433class Erasure extends Phase with DenotTransformer {
@@ -213,8 +212,6 @@ object Erasure {
213212 val tree1 =
214213 if (tree.tpe isRef defn.NullClass )
215214 adaptToType(tree, underlying)
216- else if (wasPhantom(underlying))
217- PhantomErasure .erasedParameterRef
218215 else if (! (tree.tpe <:< tycon)) {
219216 assert(! (tree.tpe.typeSymbol.isPrimitiveValueClass))
220217 val nullTree = Literal (Constant (null ))
@@ -437,16 +434,9 @@ object Erasure {
437434 }
438435 }
439436
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 ))
443438 }
444439
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-
450440 override def typedThis (tree : untpd.This )(implicit ctx : Context ): Tree =
451441 if (tree.symbol == ctx.owner.lexicallyEnclosingClass || tree.symbol.isStaticOwner) promote(tree)
452442 else {
@@ -507,11 +497,9 @@ object Erasure {
507497 .withType(defn.ArrayOf (defn.ObjectType ))
508498 args0 = bunchedArgs :: Nil
509499 }
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
515503 case _ =>
516504 throw new MatchError (i " tree $tree has unexpected type of function ${fun1.tpe.widen}, was ${fun.typeOpt.widen}" )
517505 }
@@ -572,11 +560,6 @@ object Erasure {
572560 rhs1 = untpd.Block (paramDefs, rhs1)
573561 }
574562 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- }
580563 val ddef1 = untpd.cpy.DefDef (ddef)(
581564 tparams = Nil ,
582565 vparamss = vparamss1,
@@ -703,7 +686,4 @@ object Erasure {
703686
704687 def takesBridges (sym : Symbol )(implicit ctx : Context ) =
705688 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
709689}
0 commit comments