summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala9
-rw-r--r--test/files/neg/bug4533.check4
-rw-r--r--test/files/neg/bug4533.scala8
3 files changed, 21 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
index 0940598bd2..862e37ec2b 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
@@ -56,6 +56,15 @@ abstract class Pickler extends SubComponent {
case _ =>
}
}
+ // If there are any erroneous types in the tree, then we will crash
+ // when we pickle it: so let's report an erorr instead. We know next
+ // to nothing about what happened, but our supposition is a lot better
+ // than "bad type: <error>" in terms of explanatory power.
+ for (t <- unit.body ; if t.isErroneous) {
+ unit.error(t.pos, "erroneous or inaccessible type")
+ return
+ }
+
pickle(unit.body)
}
}
diff --git a/test/files/neg/bug4533.check b/test/files/neg/bug4533.check
new file mode 100644
index 0000000000..e1b60aa820
--- /dev/null
+++ b/test/files/neg/bug4533.check
@@ -0,0 +1,4 @@
+bug4533.scala:6: error: erroneous or inaccessible type
+ def statusByAlarms(alarms: GenTraversableOnce[FooAlarm]) = println("hello")
+ ^
+one error found
diff --git a/test/files/neg/bug4533.scala b/test/files/neg/bug4533.scala
new file mode 100644
index 0000000000..0346b5d1d5
--- /dev/null
+++ b/test/files/neg/bug4533.scala
@@ -0,0 +1,8 @@
+package demo
+
+import scala.collection._
+
+class CrashDemo {
+ def statusByAlarms(alarms: GenTraversableOnce[FooAlarm]) = println("hello")
+}
+class FooAlarm { }