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

type errors can be wrong-kinded #5440

Open
ceedubs opened this issue Nov 5, 2024 · 2 comments
Open

type errors can be wrong-kinded #5440

ceedubs opened this issue Nov 5, 2024 · 2 comments
Labels

Comments

@ceedubs
Copy link
Contributor

ceedubs commented Nov 5, 2024

Describe and demonstrate the bug

If an expression returns a value that doesn't have the same number of type parameters as the expected type, then the type error message is confusing and shows types with kind errors.

Instead of:

 I found a value  of type:  Either Text
  where I expected to find:  Optional

I would expect:

 I found a value  of type:  Either Text a
  where I expected to find:  Optional Nat

or something like that...I'm not quite sure what it should infer for the right side of the Either.

Input:

```ucm
fresh/main> builtins.merge
```

```unison
foo : Optional Nat
foo = Left "error"
```

Output:

``` ucm
fresh/main> builtins.merge

  Done.

```
``` unison
foo : Optional Nat
foo = Left "error"
```

``` ucm

  Loading changes detected in scratch.u.

  I found a value  of type:  Either Text
  where I expected to find:  Optional
  
      1 | foo : Optional Nat
      2 | foo = Left "error"
  

```



🛑

The transcript failed due to an error in the stanza above. The error is:


  I found a value  of type:  Either Text
  where I expected to find:  Optional
  
      1 | foo : Optional Nat
      2 | foo = Left "error"

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

@ceedubs ceedubs added the bug label Nov 5, 2024
@aryairani
Copy link
Contributor

Yeah I ran into this too and found it confusing / unhelpful.

@aryairani
Copy link
Contributor

First steps would be to just dig into it a bit and see what's going on.

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

2 participants