aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Inferencing.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-06-05 10:54:03 +0200
committerMartin Odersky <odersky@gmail.com>2016-07-11 13:35:00 +0200
commitc35f817f43a776b567acef3816405b5373097842 (patch)
treefbf248d5259aef50263201b61e8761c608495b18 /src/dotty/tools/dotc/typer/Inferencing.scala
parent939d9da26ee5992c17cd1fae0a501ed66a49fb95 (diff)
downloaddotty-c35f817f43a776b567acef3816405b5373097842.tar.gz
dotty-c35f817f43a776b567acef3816405b5373097842.tar.bz2
dotty-c35f817f43a776b567acef3816405b5373097842.zip
Adapt widenForMatchSelector to new HK scheme
Diffstat (limited to 'src/dotty/tools/dotc/typer/Inferencing.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Inferencing.scala12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/Inferencing.scala b/src/dotty/tools/dotc/typer/Inferencing.scala
index f880b647e..3b79d7c4c 100644
--- a/src/dotty/tools/dotc/typer/Inferencing.scala
+++ b/src/dotty/tools/dotc/typer/Inferencing.scala
@@ -175,8 +175,14 @@ object Inferencing {
/** Recursively widen and also follow type declarations and type aliases. */
def widenForMatchSelector(tp: Type)(implicit ctx: Context): Type = tp.widen match {
- case tp: TypeRef if !tp.symbol.isClass => widenForMatchSelector(tp.info.bounds.hi)
- case tp: AnnotatedType => tp.derivedAnnotatedType(widenForMatchSelector(tp.tpe), tp.annot)
+ case tp: TypeRef if !tp.symbol.isClass =>
+ widenForMatchSelector(tp.info.bounds.hi)
+ case tp: AnnotatedType =>
+ tp.derivedAnnotatedType(widenForMatchSelector(tp.tpe), tp.annot)
+ case tp @ RefinedType(parent, rname, rinfo) if !parent.typeSymbol.isClass =>
+ tp.derivedRefinedType(widenForMatchSelector(parent), rname, rinfo)
+ case tp: RecType if !tp.parent.typeSymbol.isClass =>
+ tp.derivedRecType(widenForMatchSelector(tp.parent))
case tp => tp
}
@@ -212,7 +218,7 @@ object Inferencing {
val qualifies = (tvar: TypeVar) =>
(tree contains tvar.owningTree) || ownedBy.exists && tvar.owner == ownedBy
def interpolate() = Stats.track("interpolateUndetVars") {
- val tp = tree.tpe.widen
+ val tp = tree.tpe.widen // TODO add `.BetaReduce` ?
constr.println(s"interpolate undet vars in ${tp.show}, pos = ${tree.pos}, mode = ${ctx.mode}, undets = ${constraint.uninstVars map (tvar => s"${tvar.show}@${tvar.owningTree.pos}")}")
constr.println(s"qualifying undet vars: ${constraint.uninstVars filter qualifies map (tvar => s"$tvar / ${tvar.show}")}, constraint: ${constraint.show}")