This commit is contained in:
nora 2023-07-29 18:31:39 +02:00
parent 9ac5fec4bd
commit 27a4ecc46b
3 changed files with 40 additions and 17 deletions

View file

@ -546,12 +546,13 @@ export function checkBody(
infcx.assign(TY_BOOL, cond.ty!, cond.span);
let ty;
let ty: Ty;
if (elsePart) {
infcx.assign(then.ty!, elsePart.ty!, elsePart.span);
ty = then.ty!;
} else {
infcx.assign(TY_UNIT, then.ty!, then.span);
ty = TY_UNIT;
}
return { ...expr, cond, then, else: elsePart, ty };