@@ -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 {
@@ -210,8 +209,6 @@ object Erasure {
210209 val tree1 =
211210 if (tree.tpe isRef defn.NullClass )
212211 adaptToType(tree, underlying)
213- else if (wasPhantom(underlying))
214- PhantomErasure .erasedParameterRef
215212 else if (! (tree.tpe <:< tycon)) {
216213 assert(! (tree.tpe.typeSymbol.isPrimitiveValueClass))
217214 val nullTree = Literal (Constant (null ))
@@ -427,16 +424,9 @@ object Erasure {
427424 }
428425 }
429426
430- if ((origSym eq defn.Phantom_assume ) || (origSym.is(Flags .ParamAccessor ) && wasPhantom(pt)))
431- PhantomErasure .erasedAssume
432- else recur(typed(tree.qualifier, AnySelectionProto ))
427+ recur(typed(tree.qualifier, AnySelectionProto ))
433428 }
434429
435- override def typedIdent (tree : untpd.Ident , pt : Type )(implicit ctx : Context ): tpd.Tree =
436- if (tree.symbol eq defn.Phantom_assume ) PhantomErasure .erasedAssume
437- else if (tree.symbol.is(Flags .Param ) && wasPhantom(tree.typeOpt)) PhantomErasure .erasedParameterRef
438- else super .typedIdent(tree, pt)
439-
440430 override def typedThis (tree : untpd.This )(implicit ctx : Context ): Tree =
441431 if (tree.symbol == ctx.owner.lexicallyEnclosingClass || tree.symbol.isStaticOwner) promote(tree)
442432 else {
@@ -496,11 +486,9 @@ object Erasure {
496486 .withType(defn.ArrayOf (defn.ObjectType ))
497487 args0 = bunchedArgs :: Nil
498488 }
499- // Arguments are phantom if an only if the parameters are phantom, guaranteed by the separation of type lattices
500- val args1 = args0.filterConserve(arg => ! wasPhantom(arg.typeOpt))
501- assert(args1 hasSameLengthAs mt.paramInfos)
502- val args2 = args1.zipWithConserve(mt.paramInfos)(typedExpr)
503- untpd.cpy.Apply (tree)(fun1, args2) withType mt.resultType
489+ assert(args0 hasSameLengthAs mt.paramInfos)
490+ val args1 = args0.zipWithConserve(mt.paramInfos)(typedExpr)
491+ untpd.cpy.Apply (tree)(fun1, args1) withType mt.resultType
504492 case _ =>
505493 throw new MatchError (i " tree $tree has unexpected type of function ${fun1.tpe.widen}, was ${fun.typeOpt.widen}" )
506494 }
@@ -561,11 +549,6 @@ object Erasure {
561549 rhs1 = untpd.Block (paramDefs, rhs1)
562550 }
563551 vparamss1 = vparamss1.mapConserve(_.filterConserve(! _.symbol.is(Flags .Unused )))
564- vparamss1 = vparamss1.mapConserve(_.filterConserve(vparam => ! wasPhantom(vparam.tpe)))
565- if (sym.is(Flags .ParamAccessor ) && wasPhantom(ddef.tpt.tpe)) {
566- sym.resetFlag(Flags .ParamAccessor )
567- rhs1 = PhantomErasure .erasedParameterRef
568- }
569552 val ddef1 = untpd.cpy.DefDef (ddef)(
570553 tparams = Nil ,
571554 vparamss = vparamss1,
@@ -680,7 +663,4 @@ object Erasure {
680663
681664 def takesBridges (sym : Symbol )(implicit ctx : Context ) =
682665 sym.isClass && ! sym.is(Flags .Trait | Flags .Package )
683-
684- private def wasPhantom (tp : Type )(implicit ctx : Context ): Boolean =
685- tp.widenDealias.classSymbol eq defn.ErasedPhantomClass
686666}
0 commit comments