aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-09-30 10:07:41 +0200
committerMartin Odersky <odersky@gmail.com>2013-09-30 10:11:55 +0200
commite28dd856f6c0ccbd4094a73311a9c820f73913c4 (patch)
tree31acfaf5d391cb37db486c4bd585520bb228c165 /src/dotty/tools/dotc/typer
parent968b608ea6f2d42d48f30e311d6008600dad27a8 (diff)
downloaddotty-e28dd856f6c0ccbd4094a73311a9c820f73913c4.tar.gz
dotty-e28dd856f6c0ccbd4094a73311a9c820f73913c4.tar.bz2
dotty-e28dd856f6c0ccbd4094a73311a9c820f73913c4.zip
Changed logic for merges in lub/glb
Now throws an exception for merge conflicts of types joint by |, a warning for types joint by &. Exception is handled as in the case of CyclicRefernce. Also: Added several typerState.checkConsistent for future debugging purposes.
Diffstat (limited to 'src/dotty/tools/dotc/typer')
-rw-r--r--src/dotty/tools/dotc/typer/Implicits.scala3
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala10
2 files changed, 10 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala
index 91bc769e9..52b856864 100644
--- a/src/dotty/tools/dotc/typer/Implicits.scala
+++ b/src/dotty/tools/dotc/typer/Implicits.scala
@@ -272,8 +272,11 @@ trait Implicits { self: Typer =>
/** Search a list of eligible implicit references */
def searchImplicits(eligible: List[TermRef], contextual: Boolean): SearchResult = {
+ ctx.typerState.checkConsistent // !!! DEBUG
+
/** Try to typecheck an implicit reference */
def typedImplicit(ref: TermRef)(implicit ctx: Context): SearchResult = {
+ ctx.typerState.checkConsistent // !!! DEBUG
val id = Ident(ref).withPos(pos)
val tree =
if (argument.isEmpty) adapt(id, pt)
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index ba99ed0ca..224b3fcb1 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -851,9 +851,13 @@ class Typer extends Namer with Applications with Implicits {
}
def typed(tree: untpd.Tree, pt: Type = WildcardType)(implicit ctx: Context): Tree = ctx.traceIndented (s"typing ${tree.show}", show = true) {
- val tree1 = typedUnadapted(tree, pt)
- ctx.interpolateUndetVars(tree1.tpe.widen, tree1.pos)
- adapt(tree1, pt)
+ try {
+ val tree1 = typedUnadapted(tree, pt)
+ ctx.interpolateUndetVars(tree1.tpe.widen, tree1.pos)
+ adapt(tree1, pt)
+ } catch {
+ case ex: FatalTypeError => errorTree(tree, ex.getMessage)
+ }
}
def typedTrees(trees: List[untpd.Tree])(implicit ctx: Context): List[Tree] =