Fix match-expressions not being properly type-checked

This commit is contained in:
Sam Vervaeck 2023-05-23 21:51:14 +02:00
parent 3bc77b1bb6
commit 1d314808a9
Signed by: samvv
SSH key fingerprint: SHA256:dIg0ywU1OP+ZYifrYxy8c5esO72cIKB+4/9wkZj1VaY

View file

@ -636,8 +636,8 @@ namespace bolt {
auto NewCtx = createInferContext();
Contexts.push_back(NewCtx);
inferBindings(Case->Pattern, ValTy);
auto Ty = inferExpression(Case->Expression);
addConstraint(new CEqual(Ty, Ty, Case->Expression));
auto ResTy = inferExpression(Case->Expression);
addConstraint(new CEqual(ResTy, Ty, Case->Expression));
Contexts.pop_back();
}
if (!Match->Value) {