mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
s/constriants/constraints/g
This commit is contained in:
parent
fd5b682e48
commit
44aa1fca1c
2 changed files with 10 additions and 10 deletions
|
@ -1146,7 +1146,7 @@ fn constrain_when_branch_help(
|
||||||
headers: SendMap::default(),
|
headers: SendMap::default(),
|
||||||
vars: Vec::with_capacity(1),
|
vars: Vec::with_capacity(1),
|
||||||
constraints: Vec::with_capacity(1),
|
constraints: Vec::with_capacity(1),
|
||||||
delayed_is_open_constriants: Vec::new(),
|
delayed_is_open_constraints: Vec::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO investigate for error messages, is it better to unify all branches with a variable,
|
// TODO investigate for error messages, is it better to unify all branches with a variable,
|
||||||
|
@ -1178,7 +1178,7 @@ fn constrain_when_branch_help(
|
||||||
// must introduce the headers from the pattern before constraining the guard
|
// must introduce the headers from the pattern before constraining the guard
|
||||||
state
|
state
|
||||||
.constraints
|
.constraints
|
||||||
.append(&mut state.delayed_is_open_constriants);
|
.append(&mut state.delayed_is_open_constraints);
|
||||||
let state_constraints = constraints.and_constraint(state.constraints);
|
let state_constraints = constraints.and_constraint(state.constraints);
|
||||||
let inner = constraints.let_constraint([], [], [], guard_constraint, ret_constraint);
|
let inner = constraints.let_constraint([], [], [], guard_constraint, ret_constraint);
|
||||||
|
|
||||||
|
@ -1186,7 +1186,7 @@ fn constrain_when_branch_help(
|
||||||
} else {
|
} else {
|
||||||
state
|
state
|
||||||
.constraints
|
.constraints
|
||||||
.append(&mut state.delayed_is_open_constriants);
|
.append(&mut state.delayed_is_open_constraints);
|
||||||
let state_constraints = constraints.and_constraint(state.constraints);
|
let state_constraints = constraints.and_constraint(state.constraints);
|
||||||
(state_constraints, ret_constraint)
|
(state_constraints, ret_constraint)
|
||||||
};
|
};
|
||||||
|
@ -1278,7 +1278,7 @@ fn constrain_def_pattern(
|
||||||
headers: SendMap::default(),
|
headers: SendMap::default(),
|
||||||
vars: Vec::with_capacity(1),
|
vars: Vec::with_capacity(1),
|
||||||
constraints: Vec::with_capacity(1),
|
constraints: Vec::with_capacity(1),
|
||||||
delayed_is_open_constriants: vec![],
|
delayed_is_open_constraints: vec![],
|
||||||
};
|
};
|
||||||
|
|
||||||
constrain_pattern(
|
constrain_pattern(
|
||||||
|
@ -1376,7 +1376,7 @@ fn constrain_typed_def(
|
||||||
headers: SendMap::default(),
|
headers: SendMap::default(),
|
||||||
vars: Vec::with_capacity(arguments.len()),
|
vars: Vec::with_capacity(arguments.len()),
|
||||||
constraints: Vec::with_capacity(1),
|
constraints: Vec::with_capacity(1),
|
||||||
delayed_is_open_constriants: vec![],
|
delayed_is_open_constraints: vec![],
|
||||||
};
|
};
|
||||||
let mut vars = Vec::with_capacity(argument_pattern_state.vars.capacity() + 1);
|
let mut vars = Vec::with_capacity(argument_pattern_state.vars.capacity() + 1);
|
||||||
let ret_var = *ret_var;
|
let ret_var = *ret_var;
|
||||||
|
@ -1856,7 +1856,7 @@ pub fn rec_defs_help(
|
||||||
headers: SendMap::default(),
|
headers: SendMap::default(),
|
||||||
vars: Vec::with_capacity(arguments.len()),
|
vars: Vec::with_capacity(arguments.len()),
|
||||||
constraints: Vec::with_capacity(1),
|
constraints: Vec::with_capacity(1),
|
||||||
delayed_is_open_constriants: vec![],
|
delayed_is_open_constraints: vec![],
|
||||||
};
|
};
|
||||||
let mut vars = Vec::with_capacity(state.vars.capacity() + 1);
|
let mut vars = Vec::with_capacity(state.vars.capacity() + 1);
|
||||||
let mut pattern_types = Vec::with_capacity(state.vars.capacity());
|
let mut pattern_types = Vec::with_capacity(state.vars.capacity());
|
||||||
|
|
|
@ -18,7 +18,7 @@ pub struct PatternState {
|
||||||
pub headers: SendMap<Symbol, Loc<Type>>,
|
pub headers: SendMap<Symbol, Loc<Type>>,
|
||||||
pub vars: Vec<Variable>,
|
pub vars: Vec<Variable>,
|
||||||
pub constraints: Vec<Constraint>,
|
pub constraints: Vec<Constraint>,
|
||||||
pub delayed_is_open_constriants: Vec<Constraint>,
|
pub delayed_is_open_constraints: Vec<Constraint>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If there is a type annotation, the pattern state headers can be optimized by putting the
|
/// If there is a type annotation, the pattern state headers can be optimized by putting the
|
||||||
|
@ -181,7 +181,7 @@ pub fn constrain_pattern(
|
||||||
// so, we know that "x" (in this case, a tag union) must be open.
|
// so, we know that "x" (in this case, a tag union) must be open.
|
||||||
if could_be_a_tag_union(expected.get_type_ref()) {
|
if could_be_a_tag_union(expected.get_type_ref()) {
|
||||||
state
|
state
|
||||||
.delayed_is_open_constriants
|
.delayed_is_open_constraints
|
||||||
.push(constraints.is_open_type(expected.get_type()));
|
.push(constraints.is_open_type(expected.get_type()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ pub fn constrain_pattern(
|
||||||
Identifier(symbol) | Shadowed(_, _, symbol) => {
|
Identifier(symbol) | Shadowed(_, _, symbol) => {
|
||||||
if could_be_a_tag_union(expected.get_type_ref()) {
|
if could_be_a_tag_union(expected.get_type_ref()) {
|
||||||
state
|
state
|
||||||
.delayed_is_open_constriants
|
.delayed_is_open_constraints
|
||||||
.push(constraints.is_open_type(expected.get_type_ref().clone()));
|
.push(constraints.is_open_type(expected.get_type_ref().clone()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,7 +497,7 @@ pub fn constrain_pattern(
|
||||||
state.constraints.push(tag_con);
|
state.constraints.push(tag_con);
|
||||||
state
|
state
|
||||||
.constraints
|
.constraints
|
||||||
.append(&mut state.delayed_is_open_constriants);
|
.append(&mut state.delayed_is_open_constraints);
|
||||||
}
|
}
|
||||||
|
|
||||||
UnwrappedOpaque {
|
UnwrappedOpaque {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue