Skip to content

Commit

Permalink
Allow GADT constraining for quotes matching
Browse files Browse the repository at this point in the history
  • Loading branch information
dwijnand committed Aug 17, 2022
1 parent 742575b commit 7339ac2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions compiler/src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1855,6 +1855,9 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
// This relaxed version is needed to correctly compare dependent function types.
// See pos/i12211.scala.
def isSubInfo(info1: Type, info2: Type, symInfo: Type): Boolean =
def allowGadt = info2 match
case TypeAlias(tp) => tp.typeSymbol.name.isVarPattern // currently from quotes matching
case _ => false
info2 match
case info2: MethodType =>
info1 match
Expand All @@ -1863,8 +1866,8 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
matchingMethodParams(info1, info2, precise = false)
&& isSubInfo(info1.resultType, info2.resultType.subst(info2, info1), symInfo1.resultType)
&& sigsOK(symInfo1, info2)
case _ => inFrozenGadt { isSubType(info1, info2) }
case _ => inFrozenGadt { isSubType(info1, info2) }
case _ => inFrozenGadtIf(!allowGadt) { isSubType(info1, info2) }
case _ => inFrozenGadtIf(!allowGadt) { isSubType(info1, info2) }

val info1 = m.info.widenExpr
isSubInfo(info1, tp2.refinedInfo.widenExpr, m.symbol.info.orElse(info1))
Expand Down

0 comments on commit 7339ac2

Please sign in to comment.