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:
5050 val stripped = self.stripNull()
5151 stripped ne self
5252 }
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- }
6453 end extension
6554
6655 import ast .tpd .*
Original file line number Diff line number Diff line change @@ -382,6 +382,17 @@ object Types extends TypeUtils {
382382 case _ => false
383383 }
384384
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+
385396 /** Is this type produced as a repair for an error? */
386397 final def isError (using Context ): Boolean = stripTypeVar.isInstanceOf [ErrorType ]
387398
You can’t perform that action at this time.
0 commit comments