mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
Parse number literal width suffixes
Supports [u,i][8,16,32,64,128] and [nat,dec] Part of #2350
This commit is contained in:
parent
545882f210
commit
320827167f
112 changed files with 1159 additions and 127 deletions
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue