-
Notifications
You must be signed in to change notification settings - Fork 296
Closed
Labels
Description
Describe and demonstrate the bug
delete.term can be used to delete a type's constructor, resulting in an unnamed hash appearing in the type and a result in the todo list.
I think that instead it should fail letting you know that the constructor has references and for bonus points suggesting that you use delete.type on the type instead.
Input:
```unison
type MyType = MyConstructor
```
```ucm
fresh/main> add
fresh/main> delete.term MyType.MyConstructor
fresh/main> view MyType
fresh/main> todo
```
Output:
``` unison
type MyType = MyConstructor
```
``` ucm
Loading changes detected in scratch.u.
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`:
type MyType
```
``` ucm
fresh/main> add
⍟ I've added these definitions:
type MyType
fresh/main> delete.term MyType.MyConstructor
Done.
fresh/main> view MyType
type MyType = #326g7u3sau#0
fresh/main> todo
These types have some constructors with missing names.
1. MyType
You can use `view 1` and
`alias.term <hash> <TypeName>.<ConstructorName>` to give names
to each unnamed constructor.
```
Environment (please complete the following information):
ucm --version1e44418
Reactions are currently unavailable