@@ -1885,18 +1885,16 @@ abstract class DartTypes {
18851885 /// The types defined in 'dart:core'.
18861886 CommonElements get commonElements;
18871887
1888- bool get useLegacySubtyping;
1889-
18901888 DartType nullableType (DartType baseType) {
18911889 bool isNullable (DartType t) =>
18921890 // Note that we can assume null safety is enabled here.
18931891 t.isNull ||
18941892 t is NullableType ||
18951893 t is FutureOrType && isNullable (t.typeArgument) ||
1896- isStrongTopType (t);
1894+ isTopType (t);
18971895
18981896 DartType result;
1899- if (isStrongTopType (baseType) ||
1897+ if (isTopType (baseType) ||
19001898 baseType.isNull ||
19011899 baseType is NullableType ||
19021900 baseType is FutureOrType && isNullable (baseType.typeArgument)) {
@@ -2048,14 +2046,10 @@ abstract class DartTypes {
20482046 }
20492047
20502048 /// Returns `true` if [t] is a bottom type, that is, a subtype of every type.
2051- bool isBottomType (DartType t) =>
2052- t is NeverType || (useLegacySubtyping && t.isNull);
2049+ bool isBottomType (DartType t) => t is NeverType ;
20532050
20542051 /// Returns `true` if [t] is a top type, that is, a supertype of every type.
20552052 bool isTopType (DartType t) =>
2056- isStrongTopType (t) || useLegacySubtyping && t.isObject;
2057-
2058- bool isStrongTopType (DartType t) =>
20592053 t is VoidType ||
20602054 t is DynamicType ||
20612055 t is ErasedType ||
@@ -2111,7 +2105,7 @@ abstract class DartTypes {
21112105 if (isTopType (t)) return true ;
21122106
21132107 // Left Top:
2114- if (isStrongTopType (s)) return false ;
2108+ if (isTopType (s)) return false ;
21152109
21162110 // Left Bottom:
21172111 if (isBottomType (s)) return true ;
@@ -2127,15 +2121,15 @@ abstract class DartTypes {
21272121 // Left Null:
21282122 // Note: Interchanging the Left Null and Right Object rules allows us to
21292123 // reduce casework.
2130- if (! useLegacySubtyping && s.isNull) {
2124+ if (s.isNull) {
21312125 if (t is FutureOrType ) {
21322126 return isSubtype (s, t.typeArgument, env);
21332127 }
21342128 return t.isNull || t is NullableType ;
21352129 }
21362130
21372131 // Right Object:
2138- if (! useLegacySubtyping && t.isObject) {
2132+ if (t.isObject) {
21392133 if (s is FutureOrType ) {
21402134 return isSubtype (s.typeArgument, t, env);
21412135 }
@@ -2151,8 +2145,7 @@ abstract class DartTypes {
21512145
21522146 // Left Nullable:
21532147 if (s is NullableType ) {
2154- return (useLegacySubtyping ||
2155- isSubtype (commonElements.nullType, t, env)) &&
2148+ return (isSubtype (commonElements.nullType, t, env)) &&
21562149 isSubtype (s.baseType, t, env);
21572150 }
21582151
@@ -2172,8 +2165,7 @@ abstract class DartTypes {
21722165
21732166 // Right Nullable:
21742167 if (t is NullableType ) {
2175- return (! useLegacySubtyping &&
2176- isSubtype (s, commonElements.nullType, env)) ||
2168+ return (isSubtype (s, commonElements.nullType, env)) ||
21772169 isSubtype (s, t.baseType, env);
21782170 }
21792171
@@ -2280,14 +2272,12 @@ abstract class DartTypes {
22802272 String sName = sNamed[sIndex++ ];
22812273 int comparison = sName.compareTo (tName);
22822274 if (comparison > 0 ) return false ;
2283- bool sIsRequired =
2284- ! useLegacySubtyping && sRequiredNamed.contains (sName);
2275+ bool sIsRequired = sRequiredNamed.contains (sName);
22852276 if (comparison < 0 ) {
22862277 if (sIsRequired) return false ;
22872278 continue ;
22882279 }
2289- bool tIsRequired =
2290- ! useLegacySubtyping && tRequiredNamed.contains (tName);
2280+ bool tIsRequired = tRequiredNamed.contains (tName);
22912281 if (sIsRequired && ! tIsRequired) return false ;
22922282 if (! isSubtype (
22932283 tNamedTypes[tIndex],
@@ -2299,10 +2289,8 @@ abstract class DartTypes {
22992289 break ;
23002290 }
23012291 }
2302- if (! useLegacySubtyping) {
2303- while (sIndex < sNamedLength) {
2304- if (sRequiredNamed.contains (sNamed[sIndex++ ])) return false ;
2305- }
2292+ while (sIndex < sNamedLength) {
2293+ if (sRequiredNamed.contains (sNamed[sIndex++ ])) return false ;
23062294 }
23072295 return true ;
23082296 } finally {
0 commit comments