summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2011-04-29 16:13:31 +0000
committerMartin Odersky <odersky@gmail.com>2011-04-29 16:13:31 +0000
commitf335e447254c391726d52c0a380b61183571b25b (patch)
tree9321b91ed1f829b6c4c95b92247d286e1b0938d9
parent7f6ebc97625536cfa2d86241349237a2e474ce74 (diff)
downloadscala-f335e447254c391726d52c0a380b61183571b25b.tar.gz
scala-f335e447254c391726d52c0a380b61183571b25b.tar.bz2
scala-f335e447254c391726d52c0a380b61183571b25b.zip
Issuing warnings with detailed info when we enc...
Issuing warnings with detailed info when we encounter the lift crasher case.
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 788d95104c..2c89647c88 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -930,10 +930,25 @@ trait Typers extends Modes {
} catch {
case ex: TypeError =>
if (phase.id > currentRun.typerPhase.id &&
- pt.existentialSkolems.nonEmpty)
+ pt.existentialSkolems.nonEmpty) {
+ // Ignore type errors raised in later phases that are due to mismatching types with existential skolems
+ // We have lift crashing in 2.9 with an adapt failure in the pattern matcher.
+ // Here's my hypothsis why this happens. The pattern matcher defines a variable of type
+ //
+ // val x: T = expr
+ //
+ // where T is the type of expr, but T contains existential skolems ts.
+ // In that case, this value definition does not typecheck.
+ // The value definition
+ //
+ // val x: T forSome { ts } = expr
+ //
+ // would typechek. Or one can simply leave out the type of the `val':
+ //
+ // val x = expr
+ context.unit.warning(tree.pos, "recovering from existential Skolem type error in tree \n"+tree+"\nwith type "+tree.tpe+"\n expected type = "+pt+"\n context = "+context.tree)
adapt(tree, mode, pt.subst(pt.existentialSkolems, pt.existentialSkolems map (_ => WildcardType)))
- // ignore type errors raised in later phases that are due to mismatching types with existential skolems
- else
+ } else
throw ex
}
}