diff options
author | Paul Phillips <paulp@improving.org> | 2011-06-29 20:45:25 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-06-29 20:45:25 +0000 |
commit | 23555f61ace6ab55b9e646a25afdbc2208e3715c (patch) | |
tree | 8a50da74e39c93ed36876a4ccd3f4b867ed29027 | |
parent | 5e193cc89ab8f154ac67ae658be6fbeca34ca572 (diff) | |
download | scala-23555f61ace6ab55b9e646a25afdbc2208e3715c.tar.gz scala-23555f61ace6ab55b9e646a25afdbc2208e3715c.tar.bz2 scala-23555f61ace6ab55b9e646a25afdbc2208e3715c.zip |
Better signature avoidance. Review by extempore.
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala | 11 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/Erasure.scala | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index 64572deb1c..116b399ce6 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -489,9 +489,9 @@ abstract class GenJVM extends SubComponent with GenJVMUtil { * should certainly write independent signature validation. */ if (SigParser.isParserAvailable && isValidSignature(sym, sig)) { - val normalizedTpe = erasure.prepareSigMap(memberTpe) + val normalizedTpe = atPhase(currentRun.erasurePhase)(erasure.prepareSigMap(memberTpe)) val bytecodeTpe = owner.thisType.memberInfo(sym) - if (erasure.erasure(normalizedTpe) =:= bytecodeTpe) { + if (sym.isType || (erasure.erasure(normalizedTpe) =:= bytecodeTpe)) { val index = jmember.getConstantPool.addUtf8(sig).toShort if (opt.verboseDebug) atPhase(currentRun.erasurePhase) { @@ -500,12 +500,17 @@ abstract class GenJVM extends SubComponent with GenJVMUtil { val buf = ByteBuffer.allocate(2) buf putShort index addAttribute(jmember, tpnme.SignatureATTR, buf) - } else clasz.cunit.warning(sym.pos, + } else { + if (sym.hasFlag(Flags.MIXEDIN)) + ()// println("suppressing signature for mixedin "+sym) + else + clasz.cunit.warning(sym.pos, """|compiler bug: created generic signature for %s in %s that does not conform to its erasure |signature: %s |erasure type: %s |if this is reproducible, please report bug at http://lampsvn.epfl.ch/trac/scala """.trim.stripMargin.format(sym, sym.owner.skipPackageObject.fullName, sig, bytecodeTpe)) + } } else clasz.cunit.warning(sym.pos, """|compiler bug: created invalid generic signature for %s in %s |signature: %s diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala index 257e46914b..6c4d4d2540 100644 --- a/src/compiler/scala/tools/nsc/transform/Erasure.scala +++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala @@ -262,7 +262,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer with ast. else squashBoxed(tp1) } if (sym == ArrayClass && args.nonEmpty) - if (unboundedGenericArrayLevel(tp) == 1) ObjectClass.tpe + if (unboundedGenericArrayLevel(tp1) == 1) ObjectClass.tpe else mapOver(tp1) else if (sym == AnyClass || sym == AnyValClass || sym == SingletonClass) ObjectClass.tpe @@ -351,8 +351,6 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer with ast. jsig(RuntimeNothingClass.tpe) else if (sym == NullClass) jsig(RuntimeNullClass.tpe) - else if (isValueClass(sym)) - abbrvTag(sym).toString else if (sym.isClass) { val preRebound = pre.baseType(sym.owner) // #2585 dotCleanup( |