Skip to content

Commit 23f2d75

Browse files
committed
Properly record the usage of GADT bounds
1 parent 65b171c commit 23f2d75

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,14 +1167,16 @@ 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
1170+
def byGadtBounds: Boolean =
1171+
{
1172+
tycon2 match
1173+
case tycon2: TypeRef =>
1174+
val tycon2sym = tycon2.symbol
1175+
tycon2sym.onGadtBounds { bounds2 =>
1176+
compareLower(bounds2, tyconIsTypeRef = false)
1177+
}
1178+
case _ => false
1179+
} && { GADTused = true; true }
11781180

11791181
tycon2 match {
11801182
case param2: TypeParamRef =>
@@ -1183,7 +1185,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
11831185
compareLower(bounds(param2), tyconIsTypeRef = false)
11841186
case tycon2: TypeRef =>
11851187
isMatchingApply(tp1) ||
1186-
compareTyConGadtBounds ||
1188+
byGadtBounds ||
11871189
defn.isCompiletimeAppliedType(tycon2.symbol) && compareCompiletimeAppliedType(tp2, tp1, fromBelow = true) || {
11881190
tycon2.info match {
11891191
case info2: TypeBounds =>

0 commit comments

Comments
 (0)