summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2016-10-26 20:04:10 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2016-10-27 10:41:59 +0200
commit762bcdcd7fcdf75d7645b4d8a3d14a2d60ed1fd0 (patch)
treed81edca3c9295de9e34b7d13f027ed811abcc4e8
parentbde2854588eea4e3199fc97e0af92a8b35ce1705 (diff)
downloadscala-762bcdcd7fcdf75d7645b4d8a3d14a2d60ed1fd0.tar.gz
scala-762bcdcd7fcdf75d7645b4d8a3d14a2d60ed1fd0.tar.bz2
scala-762bcdcd7fcdf75d7645b4d8a3d14a2d60ed1fd0.zip
Clean up cross-check in classfile parser, remove unnecessary assignment
One of the first entries in the classfile is the class name. The classfile parser performs a cross-check by looking up the class sybmol corresponding to that name and ensures it's the same as `clazz`, the class symbol that the parser currently populates. Since 322c980 ("Another massive IDE checkin"), if at the time of the check `clazz` but the lookup returns some class, the `clazz` field is assigned. The commit following this one makes sure `clazz` is never NoSymbol, so the assignment can safely be removed.
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index e96be74ba1..e69c9f816a 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -421,13 +421,10 @@ abstract class ClassfileParser {
}
val isTopLevel = !(currentClass containsChar '$') // Java class name; *don't* try to to use Scala name decoding (SI-7532)
-
- val c = if (isTopLevel) pool.getClassSymbol(nameIdx) else clazz
if (isTopLevel) {
- if (c != clazz) {
- if ((clazz eq NoSymbol) && (c ne NoSymbol)) clazz = c
- else mismatchError(c)
- }
+ val c = pool.getClassSymbol(nameIdx)
+ // scala-dev#248: when a type alias (in a package object) shadows a class symbol, getClassSymbol returns a stub
+ if (!c.isInstanceOf[StubSymbol] && c != clazz) mismatchError(c)
}
addEnclosingTParams(clazz)