mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
feat: add inner var to IntLiteral and FloatLiteral
This commit is contained in:
parent
d62471c73a
commit
127c4e1bcc
12 changed files with 92 additions and 74 deletions
|
@ -735,8 +735,8 @@ fn pattern_to_vars_by_symbol(
|
|||
}
|
||||
|
||||
NumLiteral(_, _)
|
||||
| IntLiteral(_)
|
||||
| FloatLiteral(_)
|
||||
| IntLiteral(_, _)
|
||||
| FloatLiteral(_, _)
|
||||
| StrLiteral(_)
|
||||
| Underscore
|
||||
| MalformedPattern(_, _)
|
||||
|
@ -864,7 +864,9 @@ fn canonicalize_pending_def<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
Alias { name, ann, vars } => {
|
||||
Alias {
|
||||
name, ann, vars, ..
|
||||
} => {
|
||||
let symbol = name.value;
|
||||
let can_ann = canonicalize_annotation(env, scope, &ann.value, ann.region, var_store);
|
||||
|
||||
|
@ -1407,7 +1409,9 @@ fn to_pending_def<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
Alias { name, vars, ann } => {
|
||||
Alias {
|
||||
name, vars, ann, ..
|
||||
} => {
|
||||
let region = Region::span_across(&name.region, &ann.region);
|
||||
|
||||
match scope.introduce(
|
||||
|
|
|
@ -363,8 +363,8 @@ fn fix_values_captured_in_closure_pattern(
|
|||
}
|
||||
Identifier(_)
|
||||
| NumLiteral(_, _)
|
||||
| IntLiteral(_)
|
||||
| FloatLiteral(_)
|
||||
| IntLiteral(_, _)
|
||||
| FloatLiteral(_, _)
|
||||
| StrLiteral(_)
|
||||
| Underscore
|
||||
| Shadowed(_, _)
|
||||
|
|
|
@ -25,9 +25,9 @@ pub enum Pattern {
|
|||
ext_var: Variable,
|
||||
destructs: Vec<Located<RecordDestruct>>,
|
||||
},
|
||||
IntLiteral(i64),
|
||||
IntLiteral(Variable, i64),
|
||||
NumLiteral(Variable, i64),
|
||||
FloatLiteral(f64),
|
||||
FloatLiteral(Variable, f64),
|
||||
StrLiteral(Box<str>),
|
||||
Underscore,
|
||||
|
||||
|
@ -86,8 +86,8 @@ pub fn symbols_from_pattern_help(pattern: &Pattern, symbols: &mut Vec<Symbol>) {
|
|||
}
|
||||
|
||||
NumLiteral(_, _)
|
||||
| IntLiteral(_)
|
||||
| FloatLiteral(_)
|
||||
| IntLiteral(_, _)
|
||||
| FloatLiteral(_, _)
|
||||
| StrLiteral(_)
|
||||
| Underscore
|
||||
| MalformedPattern(_, _)
|
||||
|
@ -191,7 +191,7 @@ pub fn canonicalize_pattern<'a>(
|
|||
let problem = MalformedPatternProblem::MalformedFloat;
|
||||
malformed_pattern(env, problem, region)
|
||||
}
|
||||
Ok(float) => Pattern::FloatLiteral(float),
|
||||
Ok(float) => Pattern::FloatLiteral(var_store.fresh(), float),
|
||||
},
|
||||
ptype => unsupported_pattern(env, ptype, region),
|
||||
},
|
||||
|
@ -224,9 +224,9 @@ pub fn canonicalize_pattern<'a>(
|
|||
}
|
||||
Ok(int) => {
|
||||
if *is_negative {
|
||||
Pattern::IntLiteral(-int)
|
||||
Pattern::IntLiteral(var_store.fresh(), -int)
|
||||
} else {
|
||||
Pattern::IntLiteral(int)
|
||||
Pattern::IntLiteral(var_store.fresh(), int)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -463,8 +463,8 @@ fn add_bindings_from_patterns(
|
|||
}
|
||||
}
|
||||
NumLiteral(_, _)
|
||||
| IntLiteral(_)
|
||||
| FloatLiteral(_)
|
||||
| IntLiteral(_, _)
|
||||
| FloatLiteral(_, _)
|
||||
| StrLiteral(_)
|
||||
| Underscore
|
||||
| Shadowed(_, _)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue