File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -218,8 +218,15 @@ object Types {
218218 * For the moment this is only true for modules, but it could
219219 * be refined later.
220220 */
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+ }
223230
224231 /** Is this type produced as a repair for an error? */
225232 final def isError (implicit ctx : Context ): Boolean = stripTypeVar match {
You can’t perform that action at this time.
0 commit comments