@@ -528,8 +528,8 @@ class BoundsHelperPredicatesTest extends _BoundsTestBase {
528528class LowerBoundTest extends _BoundsTestBase {
529529 test_bottom_any () {
530530 void check (DartType T1 , DartType T2 ) {
531- expect (typeSystem. isBottom ( T1 ), isTrue, reason : _typeString ( T1 ) );
532- expect (typeSystem. isBottom ( T2 ), isFalse, reason : _typeString ( T2 ) );
531+ _assertBottom ( T1 );
532+ _assertNotBottom ( T2 );
533533 _checkGreatestLowerBound (T1 , T2 , T1 );
534534 }
535535
@@ -571,8 +571,8 @@ class LowerBoundTest extends _BoundsTestBase {
571571
572572 test_bottom_bottom () {
573573 void check (DartType T1 , DartType T2 ) {
574- expect (typeSystem. isBottom ( T1 ), isTrue, reason : _typeString ( T1 ) );
575- expect (typeSystem. isBottom ( T2 ), isTrue, reason : _typeString ( T2 ) );
574+ _assertBottom ( T1 );
575+ _assertBottom ( T2 );
576576 _checkGreatestLowerBound (T1 , T2 , T1 );
577577 }
578578
@@ -1097,11 +1097,9 @@ class LowerBoundTest extends _BoundsTestBase {
10971097
10981098 test_null_any () {
10991099 void check (DartType T2 , DartType expected) {
1100- var T2_str = _typeString (T2 );
1101-
1102- expect (typeSystem.isNull (T2 ), isFalse, reason: 'isNull: $T2_str ' );
1103- expect (typeSystem.isTop (T2 ), isFalse, reason: 'isTop: $T2_str ' );
1104- expect (typeSystem.isBottom (T2 ), isFalse, reason: 'isBottom: $T2_str ' );
1100+ _assertNotBottom (T2 );
1101+ _assertNotNull (T2 );
1102+ _assertNotTop (T2 );
11051103
11061104 _checkGreatestLowerBound (nullNone, T2 , expected);
11071105 }
@@ -1143,14 +1141,11 @@ class LowerBoundTest extends _BoundsTestBase {
11431141
11441142 test_null_null () {
11451143 void check (DartType T1 , DartType T2 ) {
1146- var T1_str = _typeString (T1 );
1147- var T2_str = _typeString (T2 );
1148-
1149- expect (typeSystem.isNull (T1 ), isTrue, reason: 'isNull: $T1_str ' );
1150- expect (typeSystem.isNull (T2 ), isTrue, reason: 'isNull: $T2_str ' );
1144+ _assertNull (T1 );
1145+ _assertNull (T2 );
11511146
1152- expect (typeSystem. isBottom ( T1 ), isFalse, reason : 'isBottom: $ T1_str ' );
1153- expect (typeSystem. isBottom ( T2 ), isFalse, reason : 'isBottom: $ T2_str ' );
1147+ _assertNotBottom ( T1 );
1148+ _assertNotBottom ( T2 );
11541149
11551150 _checkGreatestLowerBound (T1 , T2 , T1 );
11561151 }
@@ -1161,8 +1156,7 @@ class LowerBoundTest extends _BoundsTestBase {
11611156
11621157 test_object_any () {
11631158 void check (DartType T2 , DartType expected) {
1164- var T2_str = _typeString (T2 );
1165- expect (typeSystem.isObject (T2 ), isFalse, reason: 'isObject: $T2_str ' );
1159+ _assertNotObject (T2 );
11661160
11671161 _checkGreatestLowerBound (objectNone, T2 , expected);
11681162 }
@@ -1216,11 +1210,8 @@ class LowerBoundTest extends _BoundsTestBase {
12161210
12171211 test_object_object () {
12181212 void check (DartType T1 , DartType T2 ) {
1219- var T1_str = _typeString (T1 );
1220- var T2_str = _typeString (T2 );
1221-
1222- expect (typeSystem.isObject (T1 ), isTrue, reason: 'isObject: $T1_str ' );
1223- expect (typeSystem.isObject (T2 ), isTrue, reason: 'isObject: $T2_str ' );
1213+ _assertObject (T1 );
1214+ _assertObject (T2 );
12241215
12251216 _checkGreatestLowerBound (T1 , T2 , T1 );
12261217 }
@@ -1309,8 +1300,8 @@ class LowerBoundTest extends _BoundsTestBase {
13091300
13101301 test_top_any () {
13111302 void check (DartType T1 , DartType T2 ) {
1312- expect (typeSystem. isTop ( T1 ), isTrue, reason : _typeString ( T1 ) );
1313- expect (typeSystem. isTop ( T2 ), isFalse, reason : _typeString ( T2 ) );
1303+ _assertTop ( T1 );
1304+ _assertNotTop ( T2 );
13141305 _checkGreatestLowerBound (T1 , T2 , T2 );
13151306 }
13161307
@@ -1357,8 +1348,8 @@ class LowerBoundTest extends _BoundsTestBase {
13571348
13581349 test_top_top () {
13591350 void check (DartType T1 , DartType T2 ) {
1360- expect (typeSystem. isTop ( T1 ), isTrue, reason : _typeString ( T1 ) );
1361- expect (typeSystem. isTop ( T2 ), isTrue, reason : _typeString ( T2 ) );
1351+ _assertTop ( T1 );
1352+ _assertTop ( T2 );
13621353 _checkGreatestLowerBound (T1 , T2 , T2 );
13631354 }
13641355
@@ -1458,8 +1449,8 @@ actual: $resultStr
14581449class UpperBoundTest extends _BoundsTestBase {
14591450 test_bottom_any () {
14601451 void check (DartType T1 , DartType T2 ) {
1461- expect (typeSystem. isBottom ( T1 ), isTrue, reason : _typeString ( T1 ) );
1462- expect (typeSystem. isBottom ( T2 ), isFalse, reason : _typeString ( T2 ) );
1452+ _assertBottom ( T1 );
1453+ _assertNotBottom ( T2 );
14631454 _checkLeastUpperBound (T1 , T2 , T2 );
14641455 }
14651456
@@ -1501,8 +1492,8 @@ class UpperBoundTest extends _BoundsTestBase {
15011492
15021493 test_bottom_bottom () {
15031494 void check (DartType T1 , DartType T2 ) {
1504- expect (typeSystem. isBottom ( T1 ), isTrue, reason : _typeString ( T1 ) );
1505- expect (typeSystem. isBottom ( T2 ), isTrue, reason : _typeString ( T2 ) );
1495+ _assertBottom ( T1 );
1496+ _assertBottom ( T2 );
15061497 _checkLeastUpperBound (T1 , T2 , T2 );
15071498 }
15081499
@@ -1894,17 +1885,14 @@ class UpperBoundTest extends _BoundsTestBase {
18941885
18951886 test_null_any () {
18961887 void check (DartType T1 , DartType T2 , DartType expected) {
1897- var T1_str = _typeString (T1 );
1898- var T2_str = _typeString (T2 );
1888+ _assertNull (T1 );
1889+ _assertNotNull (T2 );
18991890
1900- expect (typeSystem. isNull ( T1 ), isTrue, reason : 'isNull: $ T1_str ' );
1901- expect (typeSystem. isNull ( T2 ), isFalse, reason : 'isNull: $ T2_str ' );
1891+ _assertNotTop ( T1 );
1892+ _assertNotTop ( T2 );
19021893
1903- expect (typeSystem.isTop (T1 ), isFalse, reason: 'isTop: $T1_str ' );
1904- expect (typeSystem.isTop (T2 ), isFalse, reason: 'isTop: $T2_str ' );
1905-
1906- expect (typeSystem.isBottom (T1 ), isFalse, reason: 'isBottom: $T1_str ' );
1907- expect (typeSystem.isBottom (T2 ), isFalse, reason: 'isBottom: $T2_str ' );
1894+ _assertNotBottom (T1 );
1895+ _assertNotBottom (T2 );
19081896
19091897 _checkLeastUpperBound (T1 , T2 , expected);
19101898 }
@@ -1943,14 +1931,11 @@ class UpperBoundTest extends _BoundsTestBase {
19431931
19441932 test_null_null () {
19451933 void check (DartType T1 , DartType T2 ) {
1946- var T1_str = _typeString (T1 );
1947- var T2_str = _typeString (T2 );
1948-
1949- expect (typeSystem.isNull (T1 ), isTrue, reason: 'isNull: $T1_str ' );
1950- expect (typeSystem.isNull (T2 ), isTrue, reason: 'isNull: $T2_str ' );
1934+ _assertNull (T1 );
1935+ _assertNull (T2 );
19511936
1952- expect (typeSystem. isBottom ( T1 ), isFalse, reason : 'isBottom: $ T1_str ' );
1953- expect (typeSystem. isBottom ( T2 ), isFalse, reason : 'isBottom: $ T2_str ' );
1937+ _assertNotBottom ( T1 );
1938+ _assertNotBottom ( T2 );
19541939
19551940 _checkLeastUpperBound (T1 , T2 , T2 );
19561941 }
@@ -1961,11 +1946,8 @@ class UpperBoundTest extends _BoundsTestBase {
19611946
19621947 test_object_any () {
19631948 void check (DartType T1 , DartType T2 , DartType expected) {
1964- var T1_str = _typeString (T1 );
1965- var T2_str = _typeString (T2 );
1966-
1967- expect (typeSystem.isObject (T1 ), isTrue, reason: 'isObject: $T1_str ' );
1968- expect (typeSystem.isObject (T2 ), isFalse, reason: 'isObject: $T2_str ' );
1949+ _assertObject (T1 );
1950+ _assertNotObject (T2 );
19691951
19701952 _checkLeastUpperBound (T1 , T2 , expected);
19711953 }
@@ -1983,11 +1965,8 @@ class UpperBoundTest extends _BoundsTestBase {
19831965
19841966 test_object_object () {
19851967 void check (DartType T1 , DartType T2 ) {
1986- var T1_str = _typeString (T1 );
1987- var T2_str = _typeString (T2 );
1988-
1989- expect (typeSystem.isObject (T1 ), isTrue, reason: 'isObject: $T1_str ' );
1990- expect (typeSystem.isObject (T2 ), isTrue, reason: 'isObject: $T2_str ' );
1968+ _assertObject (T1 );
1969+ _assertObject (T2 );
19911970
19921971 _checkLeastUpperBound (T1 , T2 , T2 );
19931972 }
@@ -2052,8 +2031,8 @@ class UpperBoundTest extends _BoundsTestBase {
20522031
20532032 test_top_any () {
20542033 void check (DartType T1 , DartType T2 ) {
2055- expect (typeSystem. isTop ( T1 ), isTrue, reason : _typeString ( T1 ) );
2056- expect (typeSystem. isTop ( T2 ), isFalse, reason : _typeString ( T2 ) );
2034+ _assertTop ( T1 );
2035+ _assertNotTop ( T2 );
20572036 _checkLeastUpperBound (T1 , T2 , T1 );
20582037 }
20592038
@@ -2092,8 +2071,8 @@ class UpperBoundTest extends _BoundsTestBase {
20922071
20932072 test_top_top () {
20942073 void check (DartType T1 , DartType T2 ) {
2095- expect (typeSystem. isTop ( T1 ), isTrue, reason : _typeString ( T1 ) );
2096- expect (typeSystem. isTop ( T2 ), isTrue, reason : _typeString ( T2 ) );
2074+ _assertTop ( T1 );
2075+ _assertTop ( T2 );
20972076 _checkLeastUpperBound (T1 , T2 , T1 );
20982077 }
20992078
@@ -2214,6 +2193,12 @@ actual: $resultStr
22142193
22152194@reflectiveTest
22162195class _BoundsTestBase extends AbstractTypeSystemNullSafetyTest {
2196+ void _assertBottom (DartType type) {
2197+ if (! typeSystem.isBottom (type)) {
2198+ fail ('isBottom must be true: ' + _typeString (type));
2199+ }
2200+ }
2201+
22172202 void _assertNotBottom (DartType type) {
22182203 if (typeSystem.isBottom (type)) {
22192204 fail ('isBottom must be false: ' + _typeString (type));
@@ -2245,6 +2230,12 @@ class _BoundsTestBase extends AbstractTypeSystemNullSafetyTest {
22452230 }
22462231 }
22472232
2233+ void _assertNull (DartType type) {
2234+ if (! typeSystem.isNull (type)) {
2235+ fail ('isNull must be true: ' + _typeString (type));
2236+ }
2237+ }
2238+
22482239 void _assertNullability (DartType type, NullabilitySuffix expected) {
22492240 if (type.nullabilitySuffix != expected) {
22502241 fail ('Expected $expected in ' + _typeString (type));
@@ -2263,6 +2254,18 @@ class _BoundsTestBase extends AbstractTypeSystemNullSafetyTest {
22632254 _assertNullability (type, NullabilitySuffix .star);
22642255 }
22652256
2257+ void _assertObject (DartType type) {
2258+ if (! typeSystem.isObject (type)) {
2259+ fail ('isObject must be true: ' + _typeString (type));
2260+ }
2261+ }
2262+
2263+ void _assertTop (DartType type) {
2264+ if (! typeSystem.isTop (type)) {
2265+ fail ('isTop must be true: ' + _typeString (type));
2266+ }
2267+ }
2268+
22662269 String _typeParametersStr (TypeImpl type) {
22672270 var typeStr = '' ;
22682271
0 commit comments