aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-02-26 16:12:19 +0100
committerMartin Odersky <odersky@gmail.com>2017-02-28 19:34:42 +0100
commite4775b87c2b5e8f55bb32da9160cd37322a18f2c (patch)
tree5e51d24e6461b964743a6d0aca23e73c01f39d5a /compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
parentf449d9d3f83c7e28526cb827aa19b8eaebbb784b (diff)
downloaddotty-e4775b87c2b5e8f55bb32da9160cd37322a18f2c.tar.gz
dotty-e4775b87c2b5e8f55bb32da9160cd37322a18f2c.tar.bz2
dotty-e4775b87c2b5e8f55bb32da9160cd37322a18f2c.zip
Constrain results of dependent implicits
No reason why we should not - normalize handles implicit methods just fine. This fixes type errors in test HLists.scala.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala23
1 files changed, 9 insertions, 14 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala b/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
index d666b563e..48f79d147 100644
--- a/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
+++ b/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
@@ -62,14 +62,9 @@ object ProtoTypes {
true
}
case _: ValueTypeOrProto if !disregardProto(pt) =>
- mt match {
- case mt: MethodType =>
- mt.isDependent || isCompatible(normalize(mt, pt), pt)
- case _ =>
- isCompatible(mt, pt)
- }
- case _: WildcardType =>
- isCompatible(mt, pt)
+ isCompatible(normalize(mt, pt), pt)
+ case pt: WildcardType if pt.optBounds.exists =>
+ isCompatible(normalize(mt, pt), pt)
case _ =>
true
}
@@ -421,12 +416,12 @@ object ProtoTypes {
if (mt.isDependent) tp
else {
val rt = normalize(mt.resultType, pt)
- pt match {
- case pt: IgnoredProto => mt
- case pt: ApplyingProto => mt.derivedMethodType(mt.paramNames, mt.paramTypes, rt)
- case _ =>
- val ft = defn.FunctionOf(mt.paramTypes, rt)
- if (mt.paramTypes.nonEmpty || ft <:< pt) ft else rt
+ pt match {
+ case pt: IgnoredProto => mt
+ case pt: ApplyingProto => mt.derivedMethodType(mt.paramNames, mt.paramTypes, rt)
+ case _ =>
+ val ft = defn.FunctionOf(mt.paramTypes, rt)
+ if (mt.paramTypes.nonEmpty || ft <:< pt) ft else rt
}
}
case et: ExprType => et.resultType