-
Notifications
You must be signed in to change notification settings - Fork 147
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
Cannot use constructor when alias of type is in scope #548
Comments
I believe this is caused by another fix I made in 0.8 to make aliases like this import the constructors of the type they aliases as well (so this brings Only way to fix this might be to make variants scoped under the type ( |
Would it be possible to look up the original type that is aliased and import its variants without any type parameters applied? That would import more than you may need, but it wouldn't shadow a more general constructor. Optionally scoping variants under the type seems useful on its own though, to prevent collisions with identical variants of different types. I'd expect variants qualified like that to work like they do now, so Edit: Clicking the right button is hard, I didn't mean to close this issue :D |
Yep, that seems like a good compromise. I will look into always exporting the variant as the generic type. It is probably just a 1 line change in the typechecker |
Yeah, it doesn't seem like a lot of work, but when I tried yesterday I failed miserably, so I'll better leave this to you :p |
A bit more awkward of a solution than I had hoped as there were some annoying edge cases to consider. I may revisit precisely how this works after scoped constructors and more precise control on which constructors gets added. |
When defining a type alias for a generic type, like
Option
, that instantiates a type parameter, it is impossible to use the constructor for anything but the type of the alias:I'm not entirely sure if this is a bug, but it's certainly unexpected, and the error messages are quite confusing,
since you first get an error for the constructor and then for the binding, which seemingly contradict each other.
The text was updated successfully, but these errors were encountered: