Commit 372f889
committed
minor refactor to avoid unsoundness caused by flexible types
`propOrElse` exploits unsoundness of flexible types to take a nullable `alt` and return it as a non-null `String`. This is due to a flexible type being inferred as the type argument of `Option.apply` and of `getOrElse()`. It's possible that a `null` `alt` could be passed to `propOrElse` and it would return it, violating its return type. This refactoring cleans up `propOrElse` and related methods; it specifies a type argument explicitly to ensure that a flexible type is not inferred.1 parent 4d50e5f commit 372f889
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
| 48 | + | |
48 | 49 | | |
49 | | - | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
0 commit comments