summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala7
-rw-r--r--test/files/neg/bug766.check4
-rw-r--r--test/files/neg/bug766.scala9
3 files changed, 20 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 087f5c485f..0305a6123f 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1868,6 +1868,13 @@ trait Typers requires Analyzer {
if (settings.debug.value) System.out.println(""+tpt1+":"+tpt1.symbol+":"+tpt1.symbol.info);//debug
errorTree(tree, "wrong number of type arguments for "+tpt1.tpe+", should be "+tparams.length)
}
+
+ case TypeTree() =>
+ // we should get here only when something before failed
+ // and we try again (@see tryTypedApply). In that case we can assign
+ // whatever type to tree; we just have to survive until a real error message is issued.
+ tree setType AnyClass.tpe
+
case _ =>
throw new Error("unexpected tree: "+tree);//debug
}
diff --git a/test/files/neg/bug766.check b/test/files/neg/bug766.check
new file mode 100644
index 0000000000..5d534cbaa4
--- /dev/null
+++ b/test/files/neg/bug766.check
@@ -0,0 +1,4 @@
+bug766.scala:5 error: not found: value badIdentifier
+ val p = badIdentifier
+ ^
+one error found
diff --git a/test/files/neg/bug766.scala b/test/files/neg/bug766.scala
new file mode 100644
index 0000000000..9829b23217
--- /dev/null
+++ b/test/files/neg/bug766.scala
@@ -0,0 +1,9 @@
+object B
+{
+ def a = {
+ for (val n <- Nil; val m <- Nil) {
+ val p = badIdentifier
+ false
+ }
+ }
+}