aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-10-29 16:04:27 +0100
committerMartin Odersky <odersky@gmail.com>2013-10-29 16:04:27 +0100
commit4d230bb6613fc66b7b29339df637b8bf0e5f14b5 (patch)
tree899c20a52cd487994ce620d634113363ca1d2467 /src/dotty/tools/dotc/typer/Typer.scala
parent52a8a0aec9da8a4eaa3faf95ec7acd3ecfbabf53 (diff)
downloaddotty-4d230bb6613fc66b7b29339df637b8bf0e5f14b5.tar.gz
dotty-4d230bb6613fc66b7b29339df637b8bf0e5f14b5.tar.bz2
dotty-4d230bb6613fc66b7b29339df637b8bf0e5f14b5.zip
Fixes to type inference
1. Resolve overloading needs to be done with exploring typerstate 2. Need to handle case where A <: B for type variables in a more symmetric way. (2) is not yet fully done.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 47eee5d4d..244713496 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -981,7 +981,7 @@ class Typer extends Namer with Applications with Implicits {
val alts = altDenots map (alt =>
TermRef.withSig(ref.prefix, ref.name, alt.info.signature).withDenot(alt))
def expectedStr = err.expectedTypeStr(pt)
- resolveOverloaded(alts, pt) match {
+ resolveOverloaded(alts, pt)(ctx.fresh.withExploreTyperState) match {
case alt :: Nil =>
adapt(tree.withType(alt), pt)
case Nil =>
@@ -1053,7 +1053,11 @@ class Typer extends Namer with Applications with Implicits {
case _ =>
if (tree.tpe <:< pt) tree
else if (ctx.mode is Mode.Pattern) tree // no subtype check for pattern
- else adaptToSubType(wtp)
+ else {
+ //println(s"adapt to subtype ${tree.tpe} !<:< $pt") // !!!DEBUG
+ //println(TypeComparer.explained(implicit ctx => tree.tpe <:< pt))
+ adaptToSubType(wtp)
+ }
}
def adaptToSubType(wtp: Type): Tree = {