aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/transform/Erasure.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-08-13 11:21:37 +0200
committerMartin Odersky <odersky@gmail.com>2014-08-13 11:22:49 +0200
commitdeaa0d8bdcd5592e124acfbca1a1414365b667d7 (patch)
treea6b2bd63b05db7cae6c4b588cf406b9076a1bcb3 /src/dotty/tools/dotc/core/transform/Erasure.scala
parentab8ee535fc2f16f3ece55326e58dec6171614829 (diff)
downloaddotty-deaa0d8bdcd5592e124acfbca1a1414365b667d7.tar.gz
dotty-deaa0d8bdcd5592e124acfbca1a1414365b667d7.tar.bz2
dotty-deaa0d8bdcd5592e124acfbca1a1414365b667d7.zip
Package denotations are never transformed
Packages should always have a single denotation, which is invariant for all transformations. Package members should always be entered in the first phase, and should never be entered after a given phase. This reflects the fact that package members correspond to classfiles. Once you create a classfile, it stays around and is available from the start of the next run. Also, we need to prevent multiple denotation versions of packages from hanging on to stale symbols. It would not be enough to replace a package member by a newly compiled one; if packages had multiple denotations we'd have to do this for all of them.
Diffstat (limited to 'src/dotty/tools/dotc/core/transform/Erasure.scala')
-rw-r--r--src/dotty/tools/dotc/core/transform/Erasure.scala15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/core/transform/Erasure.scala b/src/dotty/tools/dotc/core/transform/Erasure.scala
index 587f0c088..41254c982 100644
--- a/src/dotty/tools/dotc/core/transform/Erasure.scala
+++ b/src/dotty/tools/dotc/core/transform/Erasure.scala
@@ -145,12 +145,15 @@ class Erasure(isJava: Boolean, isSemi: Boolean, isConstructor: Boolean, wildcard
case tp: PolyType =>
this(tp.resultType)
case tp @ ClassInfo(pre, cls, classParents, decls, _) =>
- def eraseTypeRef(p: TypeRef) = this(p).asInstanceOf[TypeRef]
- val parents: List[TypeRef] =
- if ((cls eq defn.ObjectClass) || cls.isPrimitiveValueClass) Nil
- else if (cls eq defn.ArrayClass) defn.ObjectClass.typeRef :: Nil
- else removeLaterObjects(classParents.mapConserve(eraseTypeRef))
- tp.derivedClassInfo(this(pre), parents, decls, this(tp.selfType))
+ if (cls is Package) tp
+ else {
+ def eraseTypeRef(p: TypeRef) = this(p).asInstanceOf[TypeRef]
+ val parents: List[TypeRef] =
+ if ((cls eq defn.ObjectClass) || cls.isPrimitiveValueClass) Nil
+ else if (cls eq defn.ArrayClass) defn.ObjectClass.typeRef :: Nil
+ else removeLaterObjects(classParents.mapConserve(eraseTypeRef))
+ tp.derivedClassInfo(this(pre), parents, decls, this(tp.selfType))
+ }
case NoType | NoPrefix | ErrorType =>
tp
case tp: WildcardType if wildcardOK =>