-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Unexpected widening of covariant literal types #8231
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
Comments
I changed the label to "enhancement" since it is not clear yet that this is a bug. Widening of singleton types is a difficult balance to achieve; every move in one direction can have downsides. |
|
As I explained on gitter:
So closing because this is not a bug (and not any different from how scala 2 behaves), but it's still on my mind. |
[EDIT] After discussion on gitter, I managed to simplify the example, and more convinced that careful planning should be taken before considering changing this behavior.
As discussed on the PR introducing literal type operations, there is a problem when attempting to use covariant literal types.
Adding a
<: Singleton
upper bound resolved this issue, but IMO it feels hacky.minimized code
Compilation output
expectation
No error
The text was updated successfully, but these errors were encountered: