roc/crates/compiler/solve
Ayaz Hafiz b43078440f
Ensure ability-bound variables are registered in their generalization pool
When we attempt to bind a type argument to an ability in an alias/opaque
instantiation, we create a fresh flex var to represent satisfaction of
the ability, and then unify the type argument with that flex var.
Previously, we did not register this fresh var in the appropriate rank
pool.

Usually this is not a problem; however, our generalization algorithm is
such that we skip adjusting the rank of redundant variables. Redundant
variables are those that are in the same unification tree, but are not
the root of the unification trees.

This means that if such a flex able var becomes the root of a
unification tree with the type argument, and the type argument is itself
generalized, we will have missed generalization of the argument.

The fix is simple - make sure to register the flex able var into the
appropriate rank pool.

Closes #4408
2022-11-16 17:09:47 -06:00
..
docs Add language to all fenced code blocks 2022-09-09 01:12:31 -06:00
src Ensure ability-bound variables are registered in their generalization pool 2022-11-16 17:09:47 -06:00
tests Ensure ability-bound variables are registered in their generalization pool 2022-11-16 17:09:47 -06:00
Cargo.toml more workspace dependencies 2022-11-13 16:10:02 +01:00