unison/unison-src/transcripts/fix2350.output.md

40 lines
1.1 KiB
Markdown
Raw Normal View History

2021-10-29 00:45:51 +03:00
This tests an issue where ability variables were being defaulted over
eagerly. In general, we want to avoid collecting up variables from the
use of definitions with types like:
T ->{e} U
Since this type works for every `e`, it is, 'pure;' and we might as
well have `e = {}`, since `{}` is a subrow of every other row.
However, if `e` isn't just a quantified variable, but one involved in
ongoing inference, it's undesirable to default it. Previously there
was a check to see if `e` occurred in the context. However, the wanted
abilities being collected aren't in the context, so types like:
T ->{S e} U ->{e} V
were a corner case. We would add `S e` to the wanted abilities, then
not realize that `e` shouldn't be defaulted.
```unison
unique ability Storage d g where
save.impl : a ->{Storage d g} ('{g} (d a))
save : a ->{Storage d g, g} (d a)
save a = !(save.impl a)
```
```ucm
I found and typechecked these definitions in scratch.u. If you
do an `add` or `update`, here's how your codebase would
change:
⍟ These new definitions are ok to `add`:
unique ability Storage d g
save : a ->{g, Storage d g} d a
```