Skip to content

Commit 65b171c

Browse files
committed
Approximate GADT lower bound for HKTs
1 parent 6655587 commit 65b171c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

compiler/src/dotty/tools/dotc/core/TypeComparer.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,13 +1167,23 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
11671167
else
11681168
fallback(tycon2bounds.lo)
11691169

1170+
def compareTyConGadtBounds: Boolean =
1171+
tycon2 match
1172+
case tycon2: TypeRef =>
1173+
val tycon2sym = tycon2.symbol
1174+
tycon2sym.onGadtBounds { bounds2 =>
1175+
compareLower(bounds2, tyconIsTypeRef = false)
1176+
}
1177+
case _ => false
1178+
11701179
tycon2 match {
11711180
case param2: TypeParamRef =>
11721181
isMatchingApply(tp1) ||
11731182
canConstrain(param2) && canInstantiate(param2) ||
11741183
compareLower(bounds(param2), tyconIsTypeRef = false)
11751184
case tycon2: TypeRef =>
11761185
isMatchingApply(tp1) ||
1186+
compareTyConGadtBounds ||
11771187
defn.isCompiletimeAppliedType(tycon2.symbol) && compareCompiletimeAppliedType(tp2, tp1, fromBelow = true) || {
11781188
tycon2.info match {
11791189
case info2: TypeBounds =>

0 commit comments

Comments
 (0)