Skip to content

Conversation

@odersky
Copy link
Contributor

@odersky odersky commented Dec 3, 2020

Consider:

val x: Int = 0 val y: Int | Null = x // during erasure, x is boxed here, and Int | Null becomes Object val z: Int = y

The last line should be an error. But previously

C | Null <: C 

succeeded for all classes C since it was deemed incorrectly that Null derivesFrom C.

Consider: ```scala val x: Int = 0 val y: Int | Null = x // during erasure, x is boxed here, and Int | Null becomes Object val z: Int = y ``` The last line should be an error. But previously ``` C | Null <: C ``` succeeded for all classes `C` since it was deemed incorrectly that `Null` derivesFrom `C`.
Copy link
Member

@noti0na1 noti0na1 left a comment

Choose a reason for hiding this comment

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

LGTM

@odersky odersky merged commit 0d1e75a into scala:master Dec 3, 2020
@odersky odersky deleted the fix-null-anyval branch December 3, 2020 21:48
@Kordyjan Kordyjan added this to the 3.0.0 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

3 participants