Parse number literal width suffixes

Supports [u,i][8,16,32,64,128] and [nat,dec]

Part of #2350
This commit is contained in:
ayazhafiz 2022-01-31 00:30:15 -05:00
parent 545882f210
commit 320827167f
112 changed files with 1159 additions and 127 deletions

View file

@ -96,8 +96,10 @@ pub fn constrain_expr(
expected: Expected<Type>,
) -> Constraint {
match expr {
Int(var, precision, _, _) => int_literal(*var, *precision, expected, region),
Num(var, _, _) => exists(
// TODO constrain with bound
Int(var, precision, _, _, _bound) => int_literal(*var, *precision, expected, region),
// TODO constrain with bound
Num(var, _, _, _bound) => exists(
vec![*var],
Eq(
crate::builtins::num_num(Type::Variable(*var)),
@ -106,7 +108,8 @@ pub fn constrain_expr(
region,
),
),
Float(var, precision, _, _) => float_literal(*var, *precision, expected, region),
// TODO constrain with bound
Float(var, precision, _, _, _bound) => float_literal(*var, *precision, expected, region),
EmptyRecord => constrain_empty_record(region, expected),
Expr::Record { record_var, fields } => {
if fields.is_empty() {