-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Unexpected erasure of opaque type with parameter #6159
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 am under the impression than all of this is working as intended. Can you point to a specific part of the sip which suggests that this should be otherwise? |
Opaque type aliases are definitely expected to always erase exactly like a normal type alias would. So any discrepancy between an opaque type alias and a transparent one, at erasure level, is a bug. |
Makes sense. Does this entirely invalidates the encoding implemented in #5300? |
Not at the level of |
Outside its companion, opaque type defined using its type parameter erases to the bound of the parameter, not the actual type argument.
That is different from normal type alias and can lead to boxing of values or overloading errors.
Code:
With
-Xprint:erasure
:Boxing
With
-Xprint:erasure
:Overloading
Output:
The text was updated successfully, but these errors were encountered: