diff options
author | Sean McDirmid <sean.mcdirmid@gmail.com> | 2006-08-21 10:24:57 +0000 |
---|---|---|
committer | Sean McDirmid <sean.mcdirmid@gmail.com> | 2006-08-21 10:24:57 +0000 |
commit | 5a90f0aebdaab1bea251887c70a615181b03b885 (patch) | |
tree | 4bebf8c84e609f0b3c72a972f11aef444eb3d355 | |
parent | ad4905c0ff97620a55d3be7790363ab44e2e4b67 (diff) | |
download | scala-5a90f0aebdaab1bea251887c70a615181b03b885.tar.gz scala-5a90f0aebdaab1bea251887c70a615181b03b885.tar.bz2 scala-5a90f0aebdaab1bea251887c70a615181b03b885.zip |
Enhanced error reporting to not eat stack trace.
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Contexts.scala | 8 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 8 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index 22d792bc4f..b1a4b74133 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -178,6 +178,14 @@ trait Contexts requires Analyzer { c } + def error(pos : Int, er : Error): Unit = { + val msg = er.getMessage(); + if (reportGeneralErrors) + unit.error(pos, if (checking) "**** ERROR DURING INTERNAL CHECKING ****\n" + msg else msg) + else + throw er; + } + def error(pos: int, msg: String): unit = if (reportGeneralErrors) unit.error(pos, if (checking) "**** ERROR DURING INTERNAL CHECKING ****\n" + msg else msg) diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 2c9797b0dc..7153fa49eb 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -145,7 +145,7 @@ trait Typers requires Analyzer { ex.getMessage() }) case _ => - context.error(pos, ex.getMessage()) + context.error(pos, ex) } } @@ -1786,8 +1786,10 @@ trait Typers requires Analyzer { new Typer(context.make(tree, owner)) /** Types expression or definition `tree' */ - def typed(tree: Tree): Tree = - typed(tree, EXPRmode, WildcardType) + def typed(tree: Tree): Tree = { + val ret = typed(tree, EXPRmode, WildcardType) + ret; + } /** Types expression `tree' with given prototype `pt' */ def typed(tree: Tree, pt: Type): Tree = |