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

Got type X instead of type Y having single variant X #339

Open
malaire opened this issue May 27, 2020 · 0 comments
Open

Got type X instead of type Y having single variant X #339

malaire opened this issue May 27, 2020 · 0 comments

Comments

@malaire
Copy link

malaire commented May 27, 2020

I recently got this kind of error

Something is off with the body of the `someFunc` definition:
...
The body is a list of type:

    List (Maybe { someField : Bool })

But the type annotation on `someFunc` says it should be:

    List SomeRecord

where SomeRecord is defined as

type SomeRecord
    = Maybe { someField: Bool }

The error here is missing alias from type SomeRecord, which makes type to have a single variant Maybe, instead of being alias to type Maybe what is used in the function.

This error can be tricky to notice, so it would be nice if compiler could detect that type Maybe and variant Maybe have same name, and report this.

@malaire malaire changed the title Got Type when expected Variant, both having exactly same name Got type X instead of type Y having single variant X May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant