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

Fix erasure of Java intersection without a class #12603

Merged
merged 1 commit into from
May 27, 2021

Conversation

smarter
Copy link
Member

@smarter smarter commented May 25, 2021

When I implemented our erasure algorithm in
#11808, I misread
https://docs.oracle.com/javase/specs/jls/se8/html/jls-4.html#jls-4.4 and
incorrectly thought that a Java intersection had to contain at least one
class, and since we always erase a Scala 3 intersection containing a
class to that class, I thought we could use the Scala 3 intersection
algorithm to erase Java intersections. But my assumption was incorrect:
a Java intersection can in fact contain only interfaces, so we need to
special-case them in erasure like before.

Fixes #12586.

When I implemented our erasure algorithm in
scala#11808, I misread
https://docs.oracle.com/javase/specs/jls/se8/html/jls-4.html#jls-4.4 and
incorrectly thought that a Java intersection had to contain at least one
class, and since we always erase a Scala 3 intersection containing a
class to that class, I thought we could use the Scala 3 intersection
algorithm to erase Java intersections. But my assumption was incorrect:
a Java intersection can in fact contain only interfaces, so we need to
special-case them in erasure like before.

Fixes scala#12586.
@smarter smarter requested a review from sjrd May 25, 2021 20:38
@sjrd sjrd merged commit 617f127 into scala:master May 27, 2021
@sjrd sjrd deleted the java-intf-and-erasure branch May 27, 2021 12:59
@Kordyjan Kordyjan added this to the 3.0.1 milestone Aug 2, 2023
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

Successfully merging this pull request may close these issues.

Incorrect erasure for intersection type in Java method
3 participants