Second pass

This commit is contained in:
ayazhafiz 2022-02-06 00:15:09 -05:00
parent 5e0d90ac53
commit 8dc92ccd97
15 changed files with 651 additions and 275 deletions

View file

@ -183,7 +183,7 @@ pub fn constrain_pattern(
let num_type = builtins::num_num(Type::Variable(var));
builtins::add_numeric_bound_constr(
let num_type = builtins::add_numeric_bound_constr(
&mut state.constraints,
num_type.clone(),
bound,
@ -202,7 +202,7 @@ pub fn constrain_pattern(
&IntLiteral(num_var, precision_var, _, _, bound) => {
// First constraint on the free num var; this improves the resolved type quality in
// case the bound is an alias.
builtins::add_numeric_bound_constr(
let num_type = builtins::add_numeric_bound_constr(
&mut state.constraints,
Type::Variable(num_var),
bound,
@ -214,7 +214,7 @@ pub fn constrain_pattern(
let int_type = builtins::num_int(Type::Variable(precision_var));
state.constraints.push(Constraint::Eq(
Type::Variable(num_var),
num_type, // TODO check me if something breaks!
Expected::NoExpectation(int_type),
Category::Int,
region,
@ -232,7 +232,7 @@ pub fn constrain_pattern(
&FloatLiteral(num_var, precision_var, _, _, bound) => {
// First constraint on the free num var; this improves the resolved type quality in
// case the bound is an alias.
builtins::add_numeric_bound_constr(
let num_type = builtins::add_numeric_bound_constr(
&mut state.constraints,
Type::Variable(num_var),
bound,
@ -244,7 +244,7 @@ pub fn constrain_pattern(
let float_type = builtins::num_float(Type::Variable(precision_var));
state.constraints.push(Constraint::Eq(
Type::Variable(num_var),
num_type.clone(), // TODO check me if something breaks!
Expected::NoExpectation(float_type),
Category::Float,
region,
@ -254,7 +254,7 @@ pub fn constrain_pattern(
state.constraints.push(Constraint::Pattern(
region,
PatternCategory::Float,
Type::Variable(num_var),
num_type, // TODO check me if something breaks!
expected,
));
}