Skip to content

Commit 4f683ab

Browse files
committed
Allow GADT constraining for quotes matching
1 parent 742575b commit 4f683ab

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,6 +1855,9 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
18551855
// This relaxed version is needed to correctly compare dependent function types.
18561856
// See pos/i12211.scala.
18571857
def isSubInfo(info1: Type, info2: Type, symInfo: Type): Boolean =
1858+
def allowGadt = info2 match
1859+
case TypeAlias(tp: TypeRef) => tp.symbol.name.isVarPattern // currently from quotes matching
1860+
case _ => false
18581861
info2 match
18591862
case info2: MethodType =>
18601863
info1 match
@@ -1863,8 +1866,8 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
18631866
matchingMethodParams(info1, info2, precise = false)
18641867
&& isSubInfo(info1.resultType, info2.resultType.subst(info2, info1), symInfo1.resultType)
18651868
&& sigsOK(symInfo1, info2)
1866-
case _ => inFrozenGadt { isSubType(info1, info2) }
1867-
case _ => inFrozenGadt { isSubType(info1, info2) }
1869+
case _ => inFrozenGadtIf(!allowGadt) { isSubType(info1, info2) }
1870+
case _ => inFrozenGadtIf(!allowGadt) { isSubType(info1, info2) }
18681871

18691872
val info1 = m.info.widenExpr
18701873
isSubInfo(info1, tp2.refinedInfo.widenExpr, m.symbol.info.orElse(info1))

0 commit comments

Comments
 (0)