diff options
author | Martin Odersky <odersky@gmail.com> | 2011-02-02 11:25:52 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2011-02-02 11:25:52 +0000 |
commit | 76dfe52fff10dd11dece7345adb23baf1131c704 (patch) | |
tree | 28bfc6903c90029126084e888f3b2fd1ad09faed /src | |
parent | 5caf65d340ff18605c971e9f80d629155f9cf6ff (diff) | |
download | scala-76dfe52fff10dd11dece7345adb23baf1131c704.tar.gz scala-76dfe52fff10dd11dece7345adb23baf1131c704.tar.bz2 scala-76dfe52fff10dd11dece7345adb23baf1131c704.zip |
2nd attempt to survive divergent implicits in t...
2nd attempt to survive divergent implicits in the presentation compiler.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/interactive/Global.scala | 19 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 5 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala index f06642eed4..4f9841cf2a 100644 --- a/src/compiler/scala/tools/nsc/interactive/Global.scala +++ b/src/compiler/scala/tools/nsc/interactive/Global.scala @@ -14,6 +14,7 @@ import scala.tools.nsc.reporters._ import scala.tools.nsc.symtab._ import scala.tools.nsc.ast._ import scala.tools.nsc.io.Pickler._ +import scala.tools.nsc.typechecker.DivergentImplicit import scala.annotation.tailrec import scala.reflect.generic.Flags.LOCKED @@ -672,14 +673,9 @@ self => */ def viewApply(view: SearchResult): Tree = { assert(view.tree != EmptyTree) - try { - analyzer.newTyper(context.makeImplicit(reportAmbiguousErrors = false)) - .typed(Apply(view.tree, List(tree)) setPos tree.pos) - } catch { - case ex: TypeError => - debugLog("type error caught: "+ex) - EmptyTree - } + analyzer.newTyper(context.makeImplicit(reportAmbiguousErrors = false)) + .typed(Apply(view.tree, List(tree)) setPos tree.pos) + .onTypeError(EmptyTree) } /** Names containing $ are not valid completions. */ @@ -831,7 +827,12 @@ self => def onTypeError(alt: => T) = try { op } catch { - case ex: TypeError => alt + case ex: TypeError => + debugLog("type error caught: "+ex) + alt + case ex: DivergentImplicit => + debugLog("divergent implicit caught: "+ex) + alt } } } diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index 55c24c3b5f..6d36c77b28 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -996,7 +996,6 @@ trait Implicits { } } } - - private class DivergentImplicit extends Exception - private val DivergentImplicit = new DivergentImplicit } +class DivergentImplicit extends Exception +object DivergentImplicit extends DivergentImplicit |