File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -50,17 +50,6 @@ object NullOpsDecorator:
50
50
val stripped = self.stripNull()
51
51
stripped ne self
52
52
}
53
-
54
- def admitsNull (using Context ): Boolean = {
55
- self.isNullType || self.isAny || (self match
56
- case OrType (l, r) => r.admitsNull || l.admitsNull
57
- case AndType (l, r) => r.admitsNull && l.admitsNull
58
- case TypeBounds (lo, hi) => lo.admitsNull
59
- case FlexibleType (lo, hi) => true
60
- case tp : TypeProxy => tp.underlying.admitsNull
61
- case _ => false
62
- )
63
- }
64
53
end extension
65
54
66
55
import ast .tpd .*
Original file line number Diff line number Diff line change @@ -382,6 +382,17 @@ object Types extends TypeUtils {
382
382
case _ => false
383
383
}
384
384
385
+ /** Is it possible that `null` is a value of this type? */
386
+ def admitsNull (using Context ): Boolean =
387
+ isNullType || isAny || (this match
388
+ case OrType (l, r) => r.admitsNull || l.admitsNull
389
+ case AndType (l, r) => r.admitsNull && l.admitsNull
390
+ case TypeBounds (lo, hi) => lo.admitsNull
391
+ case FlexibleType (lo, hi) => true
392
+ case tp : TypeProxy => tp.underlying.admitsNull
393
+ case _ => false
394
+ )
395
+
385
396
/** Is this type produced as a repair for an error? */
386
397
final def isError (using Context ): Boolean = stripTypeVar.isInstanceOf [ErrorType ]
387
398
You can’t perform that action at this time.
0 commit comments