Fix match-expressions not being properly type-checked
This commit is contained in:
parent
3bc77b1bb6
commit
1d314808a9
1 changed files with 2 additions and 2 deletions
|
@ -636,8 +636,8 @@ namespace bolt {
|
||||||
auto NewCtx = createInferContext();
|
auto NewCtx = createInferContext();
|
||||||
Contexts.push_back(NewCtx);
|
Contexts.push_back(NewCtx);
|
||||||
inferBindings(Case->Pattern, ValTy);
|
inferBindings(Case->Pattern, ValTy);
|
||||||
auto Ty = inferExpression(Case->Expression);
|
auto ResTy = inferExpression(Case->Expression);
|
||||||
addConstraint(new CEqual(Ty, Ty, Case->Expression));
|
addConstraint(new CEqual(ResTy, Ty, Case->Expression));
|
||||||
Contexts.pop_back();
|
Contexts.pop_back();
|
||||||
}
|
}
|
||||||
if (!Match->Value) {
|
if (!Match->Value) {
|
||||||
|
|
Loading…
Reference in a new issue