summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-05-22 16:31:36 +0000
committerPaul Phillips <paulp@improving.org>2010-05-22 16:31:36 +0000
commit43cc66eefd3a6915bb149b9a97156a248983d12e (patch)
treefca6a6041abd268e8bf9cf353020158cf95c24b9
parent0df04f17e09458f44f17c368c50667d4a92621c2 (diff)
downloadscala-43cc66eefd3a6915bb149b9a97156a248983d12e.tar.gz
scala-43cc66eefd3a6915bb149b9a97156a248983d12e.tar.bz2
scala-43cc66eefd3a6915bb149b9a97156a248983d12e.zip
A workaround for the crasher described in the c...
A workaround for the crasher described in the comments of #3431 (not related to #3431 per se.) Thanks to iulian for pinpointing what I can't do during completion member discovery. No review.
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/Completion.scala14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/Completion.scala b/src/compiler/scala/tools/nsc/interpreter/Completion.scala
index fddb1ee928..bdbcde31a2 100644
--- a/src/compiler/scala/tools/nsc/interpreter/Completion.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/Completion.scala
@@ -166,7 +166,19 @@ class Completion(val repl: Interpreter) extends CompletionOutput {
override def follow(id: String) =
if (completions(0) contains id) {
for (clazz <- repl clazzForIdent id) yield {
- (typeOf(clazz.getName) map TypeMemberCompletion.apply) getOrElse new InstanceCompletion(clazz)
+ // XXX The isMemberClass check is a workaround for the crasher described
+ // in the comments of #3431. The issue as described by iulian is:
+ //
+ // Inner classes exist as symbols
+ // inside their enclosing class, but also inside their package, with a mangled
+ // name (A$B). The mangled names should never be loaded, and exist only for the
+ // optimizer, which sometimes cannot get the right symbol, but it doesn't care
+ // and loads the bytecode anyway.
+ //
+ // So this solution is incorrect, but in the short term the simple fix is
+ // to skip the compiler any time completion is requested on a nested class.
+ if (clazz.isMemberClass) new InstanceCompletion(clazz)
+ else (typeOf(clazz.getName) map TypeMemberCompletion.apply) getOrElse new InstanceCompletion(clazz)
}
}
else None