Add support for tuple literals

This commit is contained in:
nora 2023-07-30 21:49:18 +02:00
parent 0c996eb9bc
commit b64c02cf4a
6 changed files with 82 additions and 35 deletions

View file

@ -768,6 +768,16 @@ export function checkBody(
return { ...expr, fields, ty: structTy };
}
case "tupleLiteral": {
const fields = expr.fields.map((expr) => this.expr(expr));
const ty: Ty = {
kind: "tuple",
elems: fields.map((field) => field.ty!),
};
return { ...expr, fields, ty };
}
}
},
};