Skip to content

Commit a0da42a

Browse files
pqCommit Queue
authored andcommitted
[element model] migrate normalize_type_test
Change-Id: I0d1420a28e7c526d2348b91563e2c254b2e126ef Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405403 Commit-Queue: Phil Quitslund <[email protected]> Auto-Submit: Phil Quitslund <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 154b473 commit a0da42a

File tree

1 file changed

+44
-46
lines changed

1 file changed

+44
-46
lines changed

pkg/analyzer/test/src/dart/element/normalize_type_test.dart

Lines changed: 44 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// ignore_for_file: analyzer_use_new_elements
6-
7-
import 'package:analyzer/dart/element/element.dart';
5+
import 'package:analyzer/dart/element/element2.dart';
86
import 'package:analyzer/dart/element/nullability_suffix.dart';
97
import 'package:analyzer/dart/element/type.dart';
108
import 'package:analyzer/src/dart/element/type.dart';
@@ -24,121 +22,121 @@ main() {
2422
class NormalizeTypeTest extends AbstractTypeSystemTest with StringTypes {
2523
test_functionType_parameter() {
2624
_check(
27-
functionTypeNone(
25+
functionTypeNone2(
2826
returnType: voidNone,
2927
parameters: [
30-
requiredParameter(type: futureOrNone(objectNone)),
28+
requiredParameter2(type: futureOrNone(objectNone)),
3129
],
3230
),
33-
functionTypeNone(
31+
functionTypeNone2(
3432
returnType: voidNone,
3533
parameters: [
36-
requiredParameter(type: objectNone),
34+
requiredParameter2(type: objectNone),
3735
],
3836
),
3937
);
4038

4139
_check(
42-
functionTypeNone(
40+
functionTypeNone2(
4341
returnType: voidNone,
4442
parameters: [
45-
namedParameter(name: 'a', type: futureOrNone(objectNone)),
43+
namedParameter2(name: 'a', type: futureOrNone(objectNone)),
4644
],
4745
),
48-
functionTypeNone(
46+
functionTypeNone2(
4947
returnType: voidNone,
5048
parameters: [
51-
namedParameter(name: 'a', type: objectNone),
49+
namedParameter2(name: 'a', type: objectNone),
5250
],
5351
),
5452
);
5553

5654
_check(
57-
functionTypeNone(
55+
functionTypeNone2(
5856
returnType: voidNone,
5957
parameters: [
60-
namedRequiredParameter(name: 'a', type: futureOrNone(objectNone)),
58+
namedRequiredParameter2(name: 'a', type: futureOrNone(objectNone)),
6159
],
6260
),
63-
functionTypeNone(
61+
functionTypeNone2(
6462
returnType: voidNone,
6563
parameters: [
66-
namedRequiredParameter(name: 'a', type: objectNone),
64+
namedRequiredParameter2(name: 'a', type: objectNone),
6765
],
6866
),
6967
);
7068

7169
_check(
72-
functionTypeNone(
70+
functionTypeNone2(
7371
returnType: voidNone,
7472
parameters: [
75-
positionalParameter(type: futureOrNone(objectNone)),
73+
positionalParameter2(type: futureOrNone(objectNone)),
7674
],
7775
),
78-
functionTypeNone(
76+
functionTypeNone2(
7977
returnType: voidNone,
8078
parameters: [
81-
positionalParameter(type: objectNone),
79+
positionalParameter2(type: objectNone),
8280
],
8381
),
8482
);
8583
}
8684

8785
test_functionType_parameter_covariant() {
8886
_check(
89-
functionTypeNone(
87+
functionTypeNone2(
9088
returnType: voidNone,
9189
parameters: [
92-
requiredParameter(type: futureOrNone(objectNone), isCovariant: true),
90+
requiredParameter2(type: futureOrNone(objectNone), isCovariant: true),
9391
],
9492
),
95-
functionTypeNone(
93+
functionTypeNone2(
9694
returnType: voidNone,
9795
parameters: [
98-
requiredParameter(type: objectNone, isCovariant: true),
96+
requiredParameter2(type: objectNone, isCovariant: true),
9997
],
10098
),
10199
);
102100
}
103101

104102
test_functionType_parameter_typeParameter() {
105-
TypeParameterElement T;
106-
TypeParameterElement T2;
103+
TypeParameterElement2 T;
104+
TypeParameterElement2 T2;
107105

108-
T = typeParameter('T', bound: neverNone);
109-
T2 = typeParameter('T2', bound: neverNone);
106+
T = typeParameter2('T', bound: neverNone);
107+
T2 = typeParameter2('T2', bound: neverNone);
110108
_check(
111-
functionTypeNone(
109+
functionTypeNone2(
112110
returnType: voidNone,
113111
typeFormals: [T],
114112
parameters: [
115-
requiredParameter(type: typeParameterTypeNone(T)),
113+
requiredParameter2(type: typeParameterTypeNone2(T)),
116114
],
117115
),
118-
functionTypeNone(
116+
functionTypeNone2(
119117
returnType: voidNone,
120118
typeFormals: [T2],
121119
parameters: [
122-
requiredParameter(type: neverNone),
120+
requiredParameter2(type: neverNone),
123121
],
124122
),
125123
);
126124

127-
T = typeParameter('T', bound: iterableNone(futureOrNone(dynamicType)));
128-
T2 = typeParameter('T2', bound: iterableNone(dynamicType));
125+
T = typeParameter2('T', bound: iterableNone(futureOrNone(dynamicType)));
126+
T2 = typeParameter2('T2', bound: iterableNone(dynamicType));
129127
_check(
130-
functionTypeNone(
128+
functionTypeNone2(
131129
returnType: voidNone,
132130
typeFormals: [T],
133131
parameters: [
134-
requiredParameter(type: typeParameterTypeNone(T)),
132+
requiredParameter2(type: typeParameterTypeNone2(T)),
135133
],
136134
),
137-
functionTypeNone(
135+
functionTypeNone2(
138136
returnType: voidNone,
139137
typeFormals: [T2],
140138
parameters: [
141-
requiredParameter(type: typeParameterTypeNone(T2)),
139+
requiredParameter2(type: typeParameterTypeNone2(T2)),
142140
],
143141
),
144142
);
@@ -381,19 +379,19 @@ class NormalizeTypeTest extends AbstractTypeSystemTest with StringTypes {
381379
/// NORM(X & T)
382380
/// * let S be NORM(T)
383381
test_typeParameter_bound() {
384-
TypeParameterElement T;
382+
TypeParameterElement2 T;
385383

386384
// * if S is Never then Never
387-
T = typeParameter('T', bound: neverNone);
388-
_check(typeParameterTypeNone(T), neverNone);
385+
T = typeParameter2('T', bound: neverNone);
386+
_check(typeParameterTypeNone2(T), neverNone);
389387

390388
// * else X
391-
T = typeParameter('T');
392-
_check(typeParameterTypeNone(T), typeParameterTypeNone(T));
389+
T = typeParameter2('T');
390+
_check(typeParameterTypeNone2(T), typeParameterTypeNone2(T));
393391

394392
// * else X
395-
T = typeParameter('T', bound: futureOrNone(objectNone));
396-
_check(typeParameterTypeNone(T), typeParameterTypeNone(T));
393+
T = typeParameter2('T', bound: futureOrNone(objectNone));
394+
_check(typeParameterTypeNone2(T), typeParameterTypeNone2(T));
397395
}
398396

399397
test_typeParameter_bound_recursive() {
@@ -474,8 +472,8 @@ actual: $resultStr
474472

475473
void _checkFormalParametersIsCovariant(DartType T1, DartType T2) {
476474
if (T1 is FunctionType && T2 is FunctionType) {
477-
var parameters1 = T1.parameters;
478-
var parameters2 = T2.parameters;
475+
var parameters1 = T1.formalParameters;
476+
var parameters2 = T2.formalParameters;
479477
expect(parameters1, hasLength(parameters2.length));
480478
for (var i = 0; i < parameters1.length; i++) {
481479
var parameter1 = parameters1[i];

0 commit comments

Comments
 (0)