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

65 lines
1.3 KiB
Markdown
Raw Permalink Normal View History

2022-06-24 02:57:32 +03:00
Tests for an unsound case of ability checking that was erroneously being
accepted before. In certain cases, abilities were able to be added to rows in
invariant positions.
``` unison
2022-06-24 02:57:32 +03:00
structural type Runner g = Runner (forall a. '{g} a -> {} a)
pureRunner : Runner {}
pureRunner = Runner base.force
-- this compiles, but shouldn't the effect type parameter on Runner be invariant?
runner : Runner {IO}
runner = pureRunner
```
``` ucm
2022-06-24 02:57:32 +03:00
Loading changes detected in scratch.u.
2022-08-26 23:19:47 +03:00
I found an ability mismatch when checking the expression in red
2022-08-26 23:19:47 +03:00
3 | pureRunner : Runner {}
4 | pureRunner = Runner base.force
5 |
6 | -- this compiles, but shouldn't the effect type parameter on Runner be invariant?
7 | runner : Runner {IO}
8 | runner = pureRunner
When trying to match Runner {} with Runner {IO} the right hand
side contained extra abilities: {IO}
2022-06-24 02:57:32 +03:00
2022-08-26 23:19:47 +03:00
```
Application version:
``` unison
2022-08-26 23:19:47 +03:00
structural type A g = A (forall a. '{g} a ->{} a)
anA : A {}
anA = A base.force
h : A {IO} -> ()
h _ = ()
> h anA
```
``` ucm
2022-08-26 23:19:47 +03:00
Loading changes detected in scratch.u.
2022-08-26 23:19:47 +03:00
I found an ability mismatch when checking the application
9 | > h anA
When trying to match A {} with A {IO} the right hand side
contained extra abilities: {IO}
2022-06-24 02:57:32 +03:00
```