summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVlad Ureche <vlad.ureche@gmail.com>2012-03-06 22:43:15 +0100
committerVlad Ureche <vlad.ureche@gmail.com>2012-03-06 22:43:15 +0100
commitc5f68c11d3d8b9f12fe8608d7cea5d33c260c793 (patch)
tree05493e3b7dbf6eb50abee2d9e41f0827e39ce8b6 /src
parent35252961db5da65307b3ba43ea9db76da73ee902 (diff)
downloadscala-c5f68c11d3d8b9f12fe8608d7cea5d33c260c793.tar.gz
scala-c5f68c11d3d8b9f12fe8608d7cea5d33c260c793.tar.bz2
scala-c5f68c11d3d8b9f12fe8608d7cea5d33c260c793.zip
Force .info before creating new synthetic syms
Closes SI-5545. In the long run this should be generalized, as other phases might suffer from the same problem. Full explanation here: https://issues.scala-lang.org/browse/SI-5545
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
index 0851dad0c2..88ad458748 100644
--- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
+++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
@@ -511,7 +511,17 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
* was both already used for a map and mucho long. So "sClass" is the
* specialized subclass of "clazz" throughout this file.
*/
- val sClass = clazz.owner.newClass(specializedName(clazz, env0).toTypeName, clazz.pos, (clazz.flags | SPECIALIZED) & ~CASE)
+
+ // SI-5545: Eliminate classes with the same name loaded from the bytecode already present - all we need to do is
+ // to force .info on them, as their lazy type will be evaluated and the symbols will be eliminated. Unfortunately
+ // evaluating the info after creating the specialized class will mess the specialized class signature, so we'd
+ // better evaluate it before creating the new class symbol
+ val clazzName = specializedName(clazz, env0).toTypeName
+ val bytecodeClazz = clazz.owner.info.decl(clazzName)
+ debuglog("Specializing " + clazz + " found " + bytecodeClazz + " already there")
+ bytecodeClazz.info
+
+ val sClass = clazz.owner.newClass(clazzName, clazz.pos, (clazz.flags | SPECIALIZED) & ~CASE)
def cloneInSpecializedClass(member: Symbol, flagFn: Long => Long) =
member.cloneSymbol(sClass, flagFn(member.flags | SPECIALIZED))