aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer
diff options
context:
space:
mode:
authorDmitry Petrashko <dark@d-d.me>2014-12-17 12:36:25 +0100
committerDmitry Petrashko <dark@d-d.me>2014-12-17 12:36:25 +0100
commitecbf5f545b46d65858d27173701def9e2a4d113a (patch)
treebba40f6bb76d8221ed2513caa7459fee728a1ba8 /src/dotty/tools/dotc/typer
parent3a68e50073e9c4cef06c44e1dec7e3e492eb3274 (diff)
parent625ad7ff89e80f29d425b9dcb2077498b11f4e7c (diff)
downloaddotty-ecbf5f545b46d65858d27173701def9e2a4d113a.tar.gz
dotty-ecbf5f545b46d65858d27173701def9e2a4d113a.tar.bz2
dotty-ecbf5f545b46d65858d27173701def9e2a4d113a.zip
Merge pull request #285 from dotty-staging/fix/catchNonFatal
Fix/catch non fatal
Diffstat (limited to 'src/dotty/tools/dotc/typer')
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala6
-rw-r--r--src/dotty/tools/dotc/typer/FrontEnd.scala3
-rw-r--r--src/dotty/tools/dotc/typer/ReTyper.scala3
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala1
4 files changed, 11 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala
index fe45beb04..c012e8837 100644
--- a/src/dotty/tools/dotc/typer/Applications.scala
+++ b/src/dotty/tools/dotc/typer/Applications.scala
@@ -763,6 +763,12 @@ trait Applications extends Compatibility { self: Typer =>
}
}
+ /** A typed unapply hook, can be overridden by re any-typers between frontend
+ * and pattern matcher.
+ */
+ def typedUnApply(tree: untpd.UnApply, selType: Type)(implicit ctx: Context) =
+ throw new UnsupportedOperationException("cannot type check an UnApply node")
+
/** Is given method reference applicable to type arguments `targs` and argument trees `args`?
* @param resultType The expected result type of the application
*/
diff --git a/src/dotty/tools/dotc/typer/FrontEnd.scala b/src/dotty/tools/dotc/typer/FrontEnd.scala
index d276792e7..f6f68d736 100644
--- a/src/dotty/tools/dotc/typer/FrontEnd.scala
+++ b/src/dotty/tools/dotc/typer/FrontEnd.scala
@@ -8,6 +8,7 @@ import dotty.tools.dotc.parsing.JavaParsers.JavaParser
import parsing.Parsers.Parser
import config.Printers._
import util.Stats._
+import scala.util.control.NonFatal
class FrontEnd extends Phase {
@@ -16,7 +17,7 @@ class FrontEnd extends Phase {
def monitor(doing: String)(body: => Unit)(implicit ctx: Context) =
try body
catch {
- case ex: Throwable =>
+ case NonFatal(ex) =>
println(s"exception occured while $doing ${ctx.compilationUnit}")
throw ex
}
diff --git a/src/dotty/tools/dotc/typer/ReTyper.scala b/src/dotty/tools/dotc/typer/ReTyper.scala
index a2d4ebad8..901542f21 100644
--- a/src/dotty/tools/dotc/typer/ReTyper.scala
+++ b/src/dotty/tools/dotc/typer/ReTyper.scala
@@ -9,6 +9,7 @@ import Decorators._
import typer.ProtoTypes._
import ast.{tpd, untpd}
import ast.Trees._
+import scala.util.control.NonFatal
/** A version of Typer that keeps all symbols defined and referenced in a
* previously typed tree.
@@ -91,7 +92,7 @@ class ReTyper extends Typer {
override def typedUnadapted(tree: untpd.Tree, pt: Type)(implicit ctx: Context) =
try super.typedUnadapted(tree, pt)
catch {
- case ex: Throwable =>
+ case NonFatal(ex) =>
println(i"exception while typing $tree of class ${tree.getClass} # ${tree.uniqueId}")
throw ex
}
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 1fe770462..97eded7cb 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -1021,6 +1021,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
case tree: untpd.PackageDef => typedPackageDef(tree)
case tree: untpd.Annotated => typedAnnotated(tree, pt)
case tree: untpd.TypedSplice => tree.tree
+ case tree: untpd.UnApply => typedUnApply(tree, pt)
case untpd.PostfixOp(tree, nme.WILDCARD) => typedAsFunction(tree, pt)
case untpd.EmptyTree => tpd.EmptyTree
case _ => typedUnadapted(desugar(tree), pt)