Commit e8bcc6e
committed
Fix problem with comparing Null and value classes
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`.1 parent 5c96a7c commit e8bcc6e
File tree
2 files changed
+18
-2
lines changed- compiler/src/dotty/tools/dotc/core
- tests/neg
2 files changed
+18
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
267 | | - | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
268 | 272 | | |
269 | | - | |
| 273 | + | |
270 | 274 | | |
271 | 275 | | |
272 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
0 commit comments