summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/transform/Flatten.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2014-10-14 16:35:35 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2014-10-15 08:15:01 +0200
commite96d1a4d346b1ebac46796307a0887d7b7c4fccf (patch)
tree591ac2ba479c358b2913d1bf5d5f912934cb1833 /src/compiler/scala/tools/nsc/transform/Flatten.scala
parent2b5df373638d08204b71258928289f6b39e25d5f (diff)
downloadscala-e96d1a4d346b1ebac46796307a0887d7b7c4fccf.tar.gz
scala-e96d1a4d346b1ebac46796307a0887d7b7c4fccf.tar.bz2
scala-e96d1a4d346b1ebac46796307a0887d7b7c4fccf.zip
SI-8907 Don't force symbol info in isModuleNotMethod
Test case by Jason. RefChecks adds the lateMETHOD flag lazily in its info transformer. This means that forcing the `sym.info` may change the value of `sym.isMethod`. 0ccdb151f introduced a check to force the info in isModuleNotMethod, but it turns out this leads to errors on stub symbols (SI-8907). The responsibility to force info is transferred to callers, which is the case for other operations on symbols, too.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/Flatten.scala')
-rw-r--r--src/compiler/scala/tools/nsc/transform/Flatten.scala7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/Flatten.scala b/src/compiler/scala/tools/nsc/transform/Flatten.scala
index fa53ef48b5..4662ef6224 100644
--- a/src/compiler/scala/tools/nsc/transform/Flatten.scala
+++ b/src/compiler/scala/tools/nsc/transform/Flatten.scala
@@ -77,8 +77,11 @@ abstract class Flatten extends InfoTransform {
if (sym.isTerm && !sym.isStaticModule) {
decls1 enter sym
if (sym.isModule) {
- // Nested, non-static moduls are transformed to methods.
- assert(sym.isMethod, s"Non-static $sym should have the lateMETHOD flag from RefChecks")
+ // In theory, we could assert(sym.isMethod), because nested, non-static moduls are
+ // transformed to methods (lateMETHOD flag added in RefChecks). But this requires
+ // forcing sym.info (see comment on isModuleNotMethod), which forces stub symbols
+ // too eagerly (SI-8907).
+
// Note that module classes are not entered into the 'decls' of the ClassInfoType
// of the outer class, only the module symbols are. So the current loop does
// not visit module classes. Therefore we set the LIFTED flag here for module