Skip to content

Commit

Permalink
[type checking] Check usage subsumption when checking function subtyping
Browse files Browse the repository at this point in the history
  • Loading branch information
tgeng committed Jul 21, 2024
1 parent 6efb4cb commit f46d76d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def checkIsSubtype
) =>
val effConstraint = checkEffSubsumption(eff1, eff2)
val tyConstraint = ctx.solve(checkIsSubtype(binding2.ty, binding1.ty))
val usageConstraint = ctx.solve(checkUsageSubsumption(binding2.usage, binding1.usage))
val bodyConstraint =
if tyConstraint.isEmpty
then checkIsSubtype(bodyTy1, bodyTy2)(using Γ :+ binding2)
Expand All @@ -172,7 +173,7 @@ def checkIsSubtype
case _ => None
},
)
effConstraint ++ tyConstraint ++ bodyConstraint
effConstraint ++ tyConstraint ++ usageConstraint ++ bodyConstraint
case (RecordType(qn1, args1, eff1), RecordType(qn2, args2, eff2)) if qn1 == qn2 =>
Σ.getRecordOption(qn1) match
case None => throw MissingDeclaration(qn1)
Expand Down

0 comments on commit f46d76d

Please sign in to comment.