aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/ConstraintHandling.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/core/ConstraintHandling.scala')
-rw-r--r--src/dotty/tools/dotc/core/ConstraintHandling.scala11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/ConstraintHandling.scala b/src/dotty/tools/dotc/core/ConstraintHandling.scala
index 66767d58a..44b6abe12 100644
--- a/src/dotty/tools/dotc/core/ConstraintHandling.scala
+++ b/src/dotty/tools/dotc/core/ConstraintHandling.scala
@@ -6,6 +6,7 @@ import Types._, Contexts._, Symbols._
import Decorators._
import config.Config
import config.Printers._
+import TypeApplications.EtaExpansion
import collection.mutable
/** Methods for adding constraints and solving them.
@@ -239,8 +240,6 @@ trait ConstraintHandling {
def addParamBound(bound: PolyParam) =
if (fromBelow) addLess(bound, param) else addLess(param, bound)
- assert(param.isHK == bound.isHK, s"$param / $bound / $fromBelow")
-
/** Drop all constrained parameters that occur at the toplevel in `bound` and
* handle them by `addLess` calls.
* The preconditions make sure that such parameters occur only
@@ -297,7 +296,13 @@ trait ConstraintHandling {
case bound: PolyParam if constraint contains bound =>
addParamBound(bound)
case _ =>
- val pbound = prune(bound)
+ var pbound = prune(bound)
+ if (pbound.isHK && !param.isHK) {
+ param match {
+ case EtaExpansion(tycon) if tycon.symbol.isClass => pbound = tycon
+ case _ =>
+ }
+ }
pbound.exists && (
if (fromBelow) addLowerBound(param, pbound) else addUpperBound(param, pbound))
}