diff options
author | Paul Phillips <paulp@improving.org> | 2012-10-01 09:40:05 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-10-04 08:45:23 -0700 |
commit | 53e8009192a9473101bf20998dd6111bd0160d6f (patch) | |
tree | 3ca1f358702d5711d63a6f32a229db642459d5bc /src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala | |
parent | 3ffc62b49914c6bf466f0f5e10c8f34b2cff5899 (diff) | |
download | scala-53e8009192a9473101bf20998dd6111bd0160d6f.tar.gz scala-53e8009192a9473101bf20998dd6111bd0160d6f.tar.bz2 scala-53e8009192a9473101bf20998dd6111bd0160d6f.zip |
Fix for gluttunous raw type creation.
ClassfileParser had a bug which led to it thinking pretty
much anything might be a raw type, and thus creating extra
symbols for no good reason. When compiling scala.collection,
before this change it thought 1094 raw types had passed by;
afterward it thought 237.
Diffstat (limited to 'src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index e4a17f3f41..53893c2eda 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -732,17 +732,19 @@ abstract class ClassfileParser { } accept('>') assert(xs.length > 0, tp) - newExistentialType(existentials.toList, typeRef(pre, classSym, xs.toList)) - } else if (classSym.isMonomorphicType) { + logResult("new existential")(newExistentialType(existentials.toList, typeRef(pre, classSym, xs.toList))) + } + // isMonomorphicType is false if the info is incomplete, as it usually is here + // so have to check unsafeTypeParams.isEmpty before worrying about raw type case below, + // or we'll create a boatload of needless existentials. + else if (classSym.isMonomorphicType || classSym.unsafeTypeParams.isEmpty) { tp - } else { + } + else { // raw type - existentially quantify all type parameters val eparams = typeParamsToExistentials(classSym, classSym.unsafeTypeParams) - val t = typeRef(pre, classSym, eparams.map(_.tpeHK)) - val res = newExistentialType(eparams, t) - if (settings.debug.value && settings.verbose.value) - println("raw type " + classSym + " -> " + res) - res + val t = typeRef(pre, classSym, eparams.map(_.tpeHK)) + logResult(s"raw type from $classSym")(newExistentialType(eparams, t)) } case tp => assert(sig.charAt(index) != '<', tp) |