File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ object NullOpsDecorator:
4747
4848 /** Is self (after widening and dealiasing) a type of the form `T | Null`? */
4949 def isNullableUnion (using Context ): Boolean = {
50- val stripped = self.stripNull()
50+ val stripped = self.stripNull(stripFlexibleTypes = false )
5151 stripped ne self
5252 }
5353 end extension
Original file line number Diff line number Diff line change 1+ // This test is based on sconfig/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfig.scala
2+ // In cases where a nullable variable is assigned a flexible type, we want
3+ // later code to type the variable access as non-nullable
4+ // Added in https://github.com/scala/scala3/pull/24278
5+
6+ def main () =
7+ var result : String | Null = null
8+ result = " " .trim()
9+ result.trim()
You can’t perform that action at this time.
0 commit comments