From 53e8009192a9473101bf20998dd6111bd0160d6f Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 1 Oct 2012 09:40:05 -0700 Subject: 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. --- .../tools/nsc/symtab/classfile/ClassfileParser.scala | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala') 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) -- cgit v1.2.3