@@ -13,7 +13,6 @@ main() {
13
13
defineReflectiveSuite (() {
14
14
defineReflectiveTests (IsConstantTypeExpressionTest );
15
15
defineReflectiveTests (PotentiallyConstantTest );
16
- defineReflectiveTests (PotentiallyConstantWithoutNullSafetyTest );
17
16
});
18
17
}
19
18
@@ -216,6 +215,18 @@ class A<T> {
216
215
''' , () => _xInitializer ());
217
216
}
218
217
218
+ test_asExpression_typeParameter_29 () async {
219
+ await _assertNotConst (r'''
220
+ // @dart = 2.9
221
+ const a = 0;
222
+ class A<T> {
223
+ m() {
224
+ var x = a as T;
225
+ }
226
+ }
227
+ ''' , () => _xInitializer (), () => [findNode.namedType ('T;' )]);
228
+ }
229
+
219
230
test_asExpression_typeParameter_nested () async {
220
231
await _assertConst (r'''
221
232
const a = 0;
@@ -518,6 +529,18 @@ class A<T> {
518
529
''' , () => _xInitializer ());
519
530
}
520
531
532
+ test_isExpression_typeParameter_29 () async {
533
+ await _assertNotConst (r'''
534
+ // @dart = 2.9
535
+ const a = 0;
536
+ class A<T> {
537
+ m() {
538
+ var x = a is T;
539
+ }
540
+ }
541
+ ''' , () => _xInitializer (), () => [findNode.namedType ('T;' )]);
542
+ }
543
+
521
544
test_isExpression_typeParameter_nested () async {
522
545
await _assertConst (r'''
523
546
const a = 0;
@@ -1097,6 +1120,25 @@ var x = A;
1097
1120
''' , () => _xInitializer ());
1098
1121
}
1099
1122
1123
+ test_simpleIdentifier_typeParameter_class () async {
1124
+ await _assertConst (r'''
1125
+ class A<T> {
1126
+ final Object f;
1127
+ A() : f = T;
1128
+ }
1129
+ ''' , () => findNode.simple ('T;' ));
1130
+ }
1131
+
1132
+ test_simpleIdentifier_typeParameter_class_214 () async {
1133
+ await _assertNotConst (r'''
1134
+ // @dart = 2.14
1135
+ class A<T> {
1136
+ final Object f;
1137
+ A() : f = T;
1138
+ }
1139
+ ''' , () => findNode.simple ('T;' ), () => [findNode.simple ('T;' )]);
1140
+ }
1141
+
1100
1142
test_spreadElement () async {
1101
1143
await _assertConst (r'''
1102
1144
const a = [0, 1, 2];
@@ -1162,46 +1204,3 @@ var x = 'a';
1162
1204
return findNode.variableDeclaration ('x = ' ).initializer! ;
1163
1205
}
1164
1206
}
1165
-
1166
- @reflectiveTest
1167
- class PotentiallyConstantWithoutNullSafetyTest extends PubPackageResolutionTest
1168
- with WithoutNullSafetyMixin {
1169
- test_asExpression_typeParameter () async {
1170
- await _assertNotConst (r'''
1171
- const a = 0;
1172
- class A<T> {
1173
- m() {
1174
- var x = a as T;
1175
- }
1176
- }
1177
- ''' , () => _xInitializer (), () => [findNode.namedType ('T;' )]);
1178
- }
1179
-
1180
- test_isExpression_typeParameter () async {
1181
- await _assertNotConst (r'''
1182
- const a = 0;
1183
- class A<T> {
1184
- m() {
1185
- var x = a is T;
1186
- }
1187
- }
1188
- ''' , () => _xInitializer (), () => [findNode.namedType ('T;' )]);
1189
- }
1190
-
1191
- _assertNotConst (String code, AstNode Function () getNode,
1192
- List <AstNode > Function () getNotConstList) async {
1193
- await resolveTestCode (code);
1194
- var node = getNode ();
1195
- var notConstList = getNotPotentiallyConstants (
1196
- node,
1197
- featureSet: featureSet,
1198
- );
1199
-
1200
- var expectedNotConst = getNotConstList ();
1201
- expect (notConstList, unorderedEquals (expectedNotConst));
1202
- }
1203
-
1204
- Expression _xInitializer () {
1205
- return findNode.variableDeclaration ('x = ' ).initializer! ;
1206
- }
1207
- }
0 commit comments