mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 23:31:12 +00:00
Reorder constraint introduction
This avoids an unnecessary clone if the conditional is false
This commit is contained in:
parent
b4c9068676
commit
9a813b6c49
1 changed files with 7 additions and 7 deletions
|
@ -164,19 +164,19 @@ pub fn constrain_pattern(
|
|||
}
|
||||
|
||||
Identifier(symbol) => {
|
||||
if destruct_position {
|
||||
state.constraints.push(Constraint::Present(
|
||||
expected.get_type_ref().clone(),
|
||||
PresenceConstraint::IsOpen,
|
||||
));
|
||||
}
|
||||
state.headers.insert(
|
||||
*symbol,
|
||||
Loc {
|
||||
region,
|
||||
value: expected.get_type_ref().clone(),
|
||||
value: expected.get_type(),
|
||||
},
|
||||
);
|
||||
if destruct_position {
|
||||
state.constraints.push(Constraint::Present(
|
||||
expected.get_type(),
|
||||
PresenceConstraint::IsOpen,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
NumLiteral(var, _, _) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue