File tree 1 file changed +9
-2
lines changed
compiler/src/dotty/tools/dotc/core 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -218,8 +218,15 @@ object Types {
218
218
* For the moment this is only true for modules, but it could
219
219
* be refined later.
220
220
*/
221
- final def isNotNull (implicit ctx : Context ): Boolean =
222
- classSymbol is ModuleClass
221
+ final def isNotNull (implicit ctx : Context ): Boolean = this match {
222
+ case tp : ConstantType => tp.value.value != null
223
+ case tp : ClassInfo => ! tp.cls.isNullableClass && tp.cls != defn.NothingClass
224
+ case tp : TypeBounds => tp.lo.isNotNull
225
+ case tp : TypeProxy => tp.underlying.isNotNull
226
+ case AndType (tp1, tp2) => tp1.isNotNull || tp2.isNotNull
227
+ case OrType (tp1, tp2) => tp1.isNotNull && tp2.isNotNull
228
+ case _ => false
229
+ }
223
230
224
231
/** Is this type produced as a repair for an error? */
225
232
final def isError (implicit ctx : Context ): Boolean = stripTypeVar match {
You can’t perform that action at this time.
0 commit comments