diff options
author | Martin Odersky <odersky@gmail.com> | 2013-09-05 15:34:14 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-09-05 15:34:14 +0200 |
commit | 15b9f3d6de17c866a1534f62c74d3d08ff5c7bf3 (patch) | |
tree | 8a824ea22749361ed721a4a56202ee47e1bb46b4 /src | |
parent | 8857d1d0a613491ffc833f5252107551f570c074 (diff) | |
download | dotty-15b9f3d6de17c866a1534f62c74d3d08ff5c7bf3.tar.gz dotty-15b9f3d6de17c866a1534f62c74d3d08ff5c7bf3.tar.bz2 dotty-15b9f3d6de17c866a1534f62c74d3d08ff5c7bf3.zip |
Foleded typeConforms back into <:<
Reason: It's better that way for explaiing types.
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/typer/Inferencing.scala | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/dotty/tools/dotc/typer/Inferencing.scala b/src/dotty/tools/dotc/typer/Inferencing.scala index 1083b4f2e..7ae20062b 100644 --- a/src/dotty/tools/dotc/typer/Inferencing.scala +++ b/src/dotty/tools/dotc/typer/Inferencing.scala @@ -27,8 +27,8 @@ object Inferencing { * 3. there is an implicit conversion from `tp` to `pt`. */ def isCompatible(tp: Type, pt: Type)(implicit ctx: Context): Boolean = ( - typeConforms(tp, pt) - || pt.typeSymbol == defn.ByNameParamClass && typeConforms(tp, pt.typeArgs.head) + (tp <:< pt) + || pt.typeSymbol == defn.ByNameParamClass && (tp <:< pt.typeArgs.head) || viewExists(tp, pt)) } @@ -43,6 +43,7 @@ object Inferencing { mbr.exists && mbr.hasAltWith(m => testCompatible(m.info)(ctx.fresh.withNewTyperState)) } } + override def toString = "Proto" + super.toString } /** Create a selection proto-type, but only one level deep; @@ -93,7 +94,7 @@ object Inferencing { * - converts non-dependent method types to the corresponding function types * - dereferences parameterless method types */ - def normalize(tp: Type)(implicit ctx: Context): Type = tp.widen match { + def normalize(tp: Type)(implicit ctx: Context): Type = tp.widenSingleton match { case pt: PolyType => normalize(ctx.track(pt).resultType) case mt: MethodType if !mt.isDependent => if (mt.isImplicit) mt.resultType @@ -136,11 +137,6 @@ object Inferencing { case tp => tp } - def typeConforms(tpe: Type, pt: Type)(implicit ctx: Context): Boolean = pt match { - case pt: ProtoType => pt.isMatchedBy(tpe) - case _ => tpe <:< pt - } - def checkBounds(args: List[Tree], poly: PolyType, pos: Position)(implicit ctx: Context): Unit = { } @@ -206,6 +202,7 @@ object Inferencing { println(i"interpolate non-occurring $tvar in $tp") tvar.instantiate(fromBelow = true) } + ctx.typerState.checkConsistent } /** Instantiate undetermined type variables to that type `tp` is |