diff options
author | Burak Emir <emir@epfl.ch> | 2007-06-03 22:50:15 +0000 |
---|---|---|
committer | Burak Emir <emir@epfl.ch> | 2007-06-03 22:50:15 +0000 |
commit | 450979f77506c0375d7dcf84219dfd226d9da499 (patch) | |
tree | a0bb8b34ee8fefbc2eaa1fcacb83f7b7914cb1e1 /src | |
parent | 724e68bab0d480fd9379afcbbb56ccc098770706 (diff) | |
download | scala-450979f77506c0375d7dcf84219dfd226d9da499.tar.gz scala-450979f77506c0375d7dcf84219dfd226d9da499.tar.bz2 scala-450979f77506c0375d7dcf84219dfd226d9da499.zip |
some debug output for fatal errors during typing
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/matching/PatternMatchers.scala | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala b/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala index 691b2370c4..539834e692 100644 --- a/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala +++ b/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala @@ -1207,13 +1207,29 @@ print() //ignore ; } - val succ = squeezedBlock(List(typed {ValDef(casted, - if(isSubType(selector.tpe,ntpe)) selector.duplicate else typed(gen.mkAsInstanceOf(selector.duplicate, ntpe, true)))}), - toTree(node.and)) + val cast_untyped = gen.mkAsInstanceOf(selector.duplicate, ntpe, true) + val vdef_untyped = ValDef(casted, + if(isSubType(selector.tpe,ntpe)) + selector.duplicate + else + cast_untyped) + try { + + val vdef = typed { vdef_untyped } + val succ = squeezedBlock(List(vdef),toTree(node.and)) val fail = toTree(node.or, selector.duplicate) return myIf(cond, succ, fail) - + } catch { + case e:TypeError => + Console.println("while typing vdef_untyped = "+vdef_untyped); + Console.println("casted.tpe = "+casted.tpe); + Console.println("(a) selector.tpe = "+selector.tpe); + Console.println("(b) pattern type(ntpe) = "+ntpe); + Console.println("isSubType(a, b) = "+isSubType(selector.tpe,ntpe)) + Console.println("cast.type = "+(typed {cast_untyped}).tpe) + throw e + } case SequencePat(casted, len) => val ntpe = node.tpe |