summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames Iry <jamesiry@gmail.com>2013-02-19 15:22:24 -0800
committerJames Iry <jamesiry@gmail.com>2013-02-19 15:22:24 -0800
commitf62d35b0d400e4d8a68046707450e58aa6d8adca (patch)
tree2c26e1057673462e757ca4948880d99de276564f /src
parent939813185e915045d24ce118639fc0472b6e5d98 (diff)
parent19649d425a761f9d6b91641df92d604f60124d08 (diff)
downloadscala-f62d35b0d400e4d8a68046707450e58aa6d8adca.tar.gz
scala-f62d35b0d400e4d8a68046707450e58aa6d8adca.tar.bz2
scala-f62d35b0d400e4d8a68046707450e58aa6d8adca.zip
Merge pull request #2138 from retronym/ticket/6576-null-strikes-back
SI-6576 Workaround / diagnostic for IDE NPE.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 341dbfbe1f..7a3ab00578 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -908,6 +908,7 @@ trait Namers extends MethodSynthesis {
// to use. clazz is the ModuleClass. sourceModule works also for classes defined in methods.
val module = clazz.sourceModule
for (cda <- module.attachments.get[ConstructorDefaultsAttachment]) {
+ debuglog(s"Storing the template namer in the ConstructorDefaultsAttachment of ${module.debugLocationString}.")
cda.companionModuleClassNamer = templateNamer
}
val classTp = ClassInfoType(parents, decls, clazz)
@@ -1229,8 +1230,11 @@ trait Namers extends MethodSynthesis {
// module's templateNamer to classAndNamerOfModule
module.attachments.get[ConstructorDefaultsAttachment] match {
// by martin: the null case can happen in IDE; this is really an ugly hack on top of an ugly hack but it seems to work
- // later by lukas: disabled when fixing SI-5975, i think it cannot happen anymore
- case Some(cda) /*if cma.companionModuleClassNamer == null*/ =>
+ case Some(cda) =>
+ if (cda.companionModuleClassNamer == null) {
+ debugwarn(s"SI-6576 The companion module namer for $meth was unexpectedly null")
+ return
+ }
val p = (cda.classWithDefault, cda.companionModuleClassNamer)
moduleNamer = Some(p)
p