Plain number literals (e.g. 5) are now Num *

This commit is contained in:
Richard Feldman 2020-03-10 20:40:53 -04:00
parent 9081b7f2d1
commit 3ecbe0325c
21 changed files with 345 additions and 223 deletions

View file

@ -53,6 +53,7 @@ fn headers_from_annotation_help(
Underscore
| Shadowed(_, _)
| UnsupportedPattern(_)
| NumLiteral(_, _)
| IntLiteral(_)
| FloatLiteral(_)
| StrLiteral(_) => true,
@ -124,10 +125,22 @@ pub fn constrain_pattern(
},
);
}
NumLiteral(var, _) => {
state.vars.push(*var);
state.constraints.push(Constraint::Pattern(
region,
PatternCategory::Num,
builtins::builtin_type(Symbol::NUM_NUM, vec![Type::Variable(*var)]),
expected,
));
}
IntLiteral(_) => {
state.constraints.push(Constraint::Pattern(
region,
PatternCategory::Int,
PatternCategory::Float,
builtins::builtin_type(Symbol::INT_INT, vec![]),
expected,
));