Skip to content

Fix #5823: better erasure of bottom types #5926

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

Merged
merged 1 commit into from
Feb 15, 2019
Merged

Conversation

abeln
Copy link
Contributor

@abeln abeln commented Feb 14, 2019

Change the definition of lub so that:

  • lub(C, {Null, Nothing}) = C if C is a reference type
  • lub(C, {Null, Nothing}) = Object if C is a value type (as before)

This allows us to generate more efficient code, and it better
matches the user's expectations.

Change the definition of lub so that:
  - lub(C, {Null, Nothing}) = C if C is a reference type
  - lub(C, {Null, Nothing}) = Object if C is a value type (as before)

This allows us to generate more efficient code, and it better
matches the user's expectations.
@abeln abeln requested a review from odersky February 14, 2019 19:00
}
}
def erasedLub(tp1: Type, tp2: Type)(implicit ctx: Context): Type = {
// After erasure, C | {Null, Nothing} is just C, if C is a reference type.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diff is misleading: I only added the check at the start, but since the pattern matching expressions is no longer at the top level the whole thing is highlighted.

@odersky odersky merged commit 1e74e9d into scala:master Feb 15, 2019
@ghost ghost removed the stat:needs review label Feb 15, 2019
@abeln abeln deleted the erase-bottom branch March 4, 2019 19:10
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.

2 participants