Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete.term can lead to unnamed constructors #5381

Open
ceedubs opened this issue Sep 30, 2024 · 0 comments
Open

delete.term can lead to unnamed constructors #5381

ceedubs opened this issue Sep 30, 2024 · 0 comments
Labels

Comments

@ceedubs
Copy link
Contributor

ceedubs commented Sep 30, 2024

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):

@ceedubs ceedubs added the bug label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant