@@ -195,7 +195,12 @@ abstract class StaticTypeVisitor extends StaticTypeBase {
195195 while (type is ir.TypeParameterType ) {
196196 type = (type as ir.TypeParameterType ).parameter.bound;
197197 }
198- return type is ir.InterfaceType ? type : null ;
198+ if (type is ir.InterfaceType ) {
199+ return type;
200+ } else if (type is ir.NullType ) {
201+ return typeEnvironment.coreTypes.deprecatedNullType;
202+ }
203+ return null ;
199204 }
200205
201206 /// Returns the static type of the expression as an instantiation of
@@ -222,7 +227,7 @@ abstract class StaticTypeVisitor extends StaticTypeBase {
222227 while (type is ir.TypeParameterType ) {
223228 type = (type as ir.TypeParameterType ).parameter.bound;
224229 }
225- if (type == typeEnvironment.nullType ) {
230+ if (type is ir. NullType ) {
226231 return typeEnvironment.coreTypes
227232 .bottomInterfaceType (superclass, currentLibrary.nullable);
228233 }
@@ -711,7 +716,7 @@ abstract class StaticTypeVisitor extends StaticTypeBase {
711716 ir.DartType promotedType = typeMap.typeOf (node, typeEnvironment);
712717 assert (
713718 node.promotedType == null ||
714- promotedType == typeEnvironment.nullType ||
719+ promotedType is ir. NullType ||
715720 promotedType is ir.FutureOrType ||
716721 typeEnvironment.isSubtypeOf (promotedType, node.promotedType,
717722 ir.SubtypeCheckMode .ignoringNullabilities),
@@ -1003,7 +1008,7 @@ abstract class StaticTypeVisitor extends StaticTypeBase {
10031008 ir.DartType visitNullCheck (ir.NullCheck node) {
10041009 ir.DartType operandType = visitNode (node.operand);
10051010 handleNullCheck (node, operandType);
1006- ir.DartType resultType = operandType == typeEnvironment.nullType
1011+ ir.DartType resultType = operandType is ir. NullType
10071012 ? const ir.NeverType (ir.Nullability .nonNullable)
10081013 : operandType.withDeclaredNullability (ir.Nullability .nonNullable);
10091014 _staticTypeCache._expressionTypes[node] = resultType;
@@ -1502,13 +1507,13 @@ class TypeHolder {
15021507 for (ir.DartType type in falseTypes) {
15031508 if (typeEnvironment.isSubtypeOf (
15041509 declaredType, type, ir.SubtypeCheckMode .ignoringNullabilities)) {
1505- return typeEnvironment.nullType ;
1510+ return const ir. NullType () ;
15061511 }
15071512 }
15081513 }
15091514 if (trueTypes != null ) {
15101515 for (ir.DartType type in trueTypes) {
1511- if (type == typeEnvironment.nullType ) {
1516+ if (type is ir. NullType ) {
15121517 return type;
15131518 }
15141519 if (typeEnvironment.isSubtypeOf (
@@ -1770,9 +1775,9 @@ class TargetInfo {
17701775 if (candidate == null ) {
17711776 candidate = type;
17721777 } else {
1773- if (type == typeEnvironment.nullType ) {
1778+ if (type is ir. NullType ) {
17741779 // Keep the current candidate.
1775- } else if (candidate == typeEnvironment.nullType ) {
1780+ } else if (candidate is ir. NullType ) {
17761781 candidate = type;
17771782 } else if (typeEnvironment.isSubtypeOf (
17781783 candidate, type, ir.SubtypeCheckMode .ignoringNullabilities)) {
0 commit comments