Commit 250facc
authored
Fix #24599
We remove `| Null` from implicit BigDecimal conversion similar to
BigInt.
```scala
// For the following function, both the parameter and the return type are non-nullable.
// However, if a null reference is passed explicitly, this method will still return null.
// We intentionally keep this signature to discourage passing nulls implicitly while
// preserving the previous behavior for backward compatibility.
/** Implicit conversion from `java.math.BigDecimal` to `scala.BigDecimal`. */
implicit def javaBigDecimal2bigDecimal(x: BigDec): BigDecimal = mapNull(x, apply(x))
/** Implicit conversion from `java.math.BigInteger` to `scala.BigInt`. */
implicit def javaBigInteger2bigInt(x: BigInteger): BigInt = mapNull(x, apply(x))
```
I have double-checked all other implicit functions in stdlib, and there
is no nullable signature left anymore.
File tree
2 files changed
+17
-1
lines changed- library/src/scala/math
- tests/explicit-nulls/pos
2 files changed
+17
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
304 | 305 | | |
305 | 306 | | |
306 | 307 | | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
307 | 313 | | |
308 | | - | |
| 314 | + | |
309 | 315 | | |
310 | 316 | | |
311 | 317 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments