mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-02 11:22:19 +00:00
Implement de-generalization for weakened let bindings
This commit is contained in:
parent
cb18291aa8
commit
5ccedca093
1 changed files with 10 additions and 1 deletions
|
@ -790,7 +790,16 @@ fn solve(
|
||||||
let_con.def_types,
|
let_con.def_types,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// If the let-binding can be generalized, introduce all variables at the next rank;
|
||||||
|
// those that persist at the next rank after rank-adjustment will be generalized.
|
||||||
|
//
|
||||||
|
// Otherwise, introduce all variables at the current rank; since none of them will
|
||||||
|
// end up at the next rank, none will be generalized.
|
||||||
|
if let_con.generalizable.0 {
|
||||||
pools.get_mut(next_rank).extend(pool_variables);
|
pools.get_mut(next_rank).extend(pool_variables);
|
||||||
|
} else {
|
||||||
|
pools.get_mut(rank).extend(pool_variables);
|
||||||
|
}
|
||||||
|
|
||||||
debug_assert_eq!(
|
debug_assert_eq!(
|
||||||
// Check that no variable ended up in a higher rank than the next rank.. that
|
// Check that no variable ended up in a higher rank than the next rank.. that
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue