roc/crates/compiler/unify
Ayaz Hafiz d7a069675b
Lambda set compaction must preserve unique specializations of concrete types
There are times that multiple concrete types may appear in
unspecialized lambda sets that are being unified. The primary case is
during monomorphization, when unspecialized lambda sets join at the same
time that concrete types get instantiated. Since lambda set
specialization and compaction happens only after unifications are
complete, unifications that monomorphize can induce the above-described
situation.

In these cases,

- unspecialized lambda sets that are due to equivalent type variables
  can be compacted, since they are in fact the same specialization.
- unspecialized lambda sets that are due to different type variables
  cannot be compacted, even if their types unify, since they may point
  to different specializations. For example, consider the unspecialized
  lambda set `[[] + [A]:toEncoder:1 + [B]:toEncoder:1]` - this set wants
  two encoders, one for `[A]` and one for `[B]`, which is materially
  different from the set `[[] + [A, B]:toEncoder:1]`.
2023-02-20 18:50:07 -06:00
..
src Lambda set compaction must preserve unique specializations of concrete types 2023-02-20 18:50:07 -06:00
Cargo.toml Support custom abilities for opaques with immaterial lambda sets 2022-11-21 18:03:56 -06:00