2022-01-20 20:36:05 +03:00
|
|
|
# Ensure type dependencies are properly considered in slurping
|
|
|
|
|
|
|
|
https://github.com/unisonweb/unison/pull/2821
|
|
|
|
|
|
|
|
Define a type.
|
|
|
|
|
2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2022-01-20 20:36:05 +03:00
|
|
|
structural type Y = Y
|
|
|
|
```
|
|
|
|
|
|
|
|
Now, we update `Y`, and add a new type `Z` which depends on it.
|
|
|
|
|
2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2022-01-20 20:36:05 +03:00
|
|
|
structural type Z = Z Y
|
|
|
|
structural type Y = Y Nat
|
|
|
|
```
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2022-01-20 20:36:05 +03:00
|
|
|
|
2023-12-22 14:55:24 +03:00
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
|
2022-01-20 20:36:05 +03:00
|
|
|
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`:
|
|
|
|
|
|
|
|
structural type Z
|
|
|
|
|
|
|
|
⍟ These names already exist. You can `update` them to your
|
|
|
|
new definition:
|
|
|
|
|
|
|
|
structural type Y
|
2023-11-08 20:11:16 +03:00
|
|
|
(The old definition is also named builtin.Unit.)
|
2022-01-20 20:36:05 +03:00
|
|
|
|
|
|
|
```
|
|
|
|
Adding should fail for BOTH definitions, `Y` needs an update and `Z` is blocked by `Y`.
|
2024-07-10 17:46:18 +03:00
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2024-10-08 23:23:34 +03:00
|
|
|
scratch/main> add
|
2022-01-20 20:36:05 +03:00
|
|
|
|
|
|
|
x These definitions failed:
|
|
|
|
|
|
|
|
Reason
|
|
|
|
needs update structural type Y
|
|
|
|
blocked structural type Z
|
|
|
|
|
|
|
|
Tip: Use `help filestatus` to learn more.
|
|
|
|
|
|
|
|
-- This shouldn't exist, because it should've been blocked.
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> view Z
|
2022-01-20 20:36:05 +03:00
|
|
|
|
|
|
|
⚠️
|
|
|
|
|
|
|
|
The following names were not found in the codebase. Check your spelling.
|
|
|
|
Z
|
|
|
|
|
|
|
|
```
|