mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-22 16:30:04 +03:00
snapshot subs to avoid cloning them
This commit is contained in:
parent
90f4885f4b
commit
62fcc71be3
@ -1784,19 +1784,19 @@ fn solve(
|
|||||||
*type_index,
|
*type_index,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let snapshot = subs.snapshot();
|
||||||
if let Success { .. } = unify(
|
if let Success { .. } = unify(
|
||||||
// TODO: if we don't clone and a later branch matches, we will get a failure in alias analysis.
|
&mut UEnv::new(subs),
|
||||||
// That said, I assume cloning is expensive and should be avoided.
|
|
||||||
&mut UEnv::new(&mut subs.clone()),
|
|
||||||
actual,
|
actual,
|
||||||
Variable::LIST_U8,
|
Variable::LIST_U8,
|
||||||
Mode::EQ,
|
Mode::EQ,
|
||||||
Polarity::OF_VALUE,
|
Polarity::OF_VALUE,
|
||||||
) {
|
) {
|
||||||
// List U8 always valid.
|
// List U8 always valid.
|
||||||
|
subs.rollback_to(snapshot);
|
||||||
state
|
state
|
||||||
} else if let Success { .. } = unify(
|
} else if let Success { .. } = unify(
|
||||||
&mut UEnv::new(&mut subs.clone()),
|
&mut UEnv::new(subs),
|
||||||
actual,
|
actual,
|
||||||
Variable::STR,
|
Variable::STR,
|
||||||
Mode::EQ,
|
Mode::EQ,
|
||||||
@ -1807,6 +1807,7 @@ fn solve(
|
|||||||
todo!("add type error due to not being a utf8 string");
|
todo!("add type error due to not being a utf8 string");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
subs.rollback_to(snapshot);
|
||||||
state
|
state
|
||||||
} else {
|
} else {
|
||||||
// Unexpected type.
|
// Unexpected type.
|
||||||
@ -1819,6 +1820,7 @@ fn solve(
|
|||||||
// );
|
// );
|
||||||
|
|
||||||
// problems.push(problem);
|
// problems.push(problem);
|
||||||
|
// subs.rollback_to(snapshot);
|
||||||
// state
|
// state
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user