Skip to content

Commit 3cc308d

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

File tree

2 files changed

+41
-36
lines changed

2 files changed

+41
-36
lines changed

pkg/analyzer/test/generated/elements_types_mixin.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,13 @@ mixin ElementsTypesMixin {
572572
);
573573
}
574574

575+
TypeParameterTypeImpl promotedTypeParameterTypeQuestion2(
576+
TypeParameterElement2 element,
577+
DartType promotedBound,
578+
) {
579+
return promotedTypeParameterTypeQuestion(element.asElement, promotedBound);
580+
}
581+
575582
RecordTypeImpl recordType({
576583
List<DartType> positionalTypes = const [],
577584
Map<String, DartType> namedTypes = const {},

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

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
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-
75
import 'package:_fe_analyzer_shared/src/type_inference/type_analyzer_operations.dart';
8-
import 'package:analyzer/dart/element/element.dart';
6+
import 'package:analyzer/dart/element/element2.dart';
97
import 'package:analyzer/dart/element/nullability_suffix.dart';
108
import 'package:analyzer/dart/element/type.dart';
119
import 'package:analyzer/src/dart/element/type.dart';
@@ -106,29 +104,29 @@ class BoundsHelperPredicatesTest extends _BoundsTestBase {
106104
}
107105

108106
test_isBottom() {
109-
TypeParameterElement T;
107+
TypeParameterElement2 T;
110108

111109
// BOTTOM(Never) is true
112110
isBottom(neverNone);
113111
isNotBottom(neverQuestion);
114112

115113
// BOTTOM(X&T) is true iff BOTTOM(T)
116-
T = typeParameter('T', bound: objectQuestion);
114+
T = typeParameter2('T', bound: objectQuestion);
117115

118-
isBottom(promotedTypeParameterTypeNone(T, neverNone));
119-
isNotBottom(promotedTypeParameterTypeQuestion(T, neverNone));
116+
isBottom(promotedTypeParameterTypeNone2(T, neverNone));
117+
isNotBottom(promotedTypeParameterTypeQuestion2(T, neverNone));
120118

121-
isNotBottom(promotedTypeParameterTypeNone(T, neverQuestion));
122-
isNotBottom(promotedTypeParameterTypeQuestion(T, neverQuestion));
119+
isNotBottom(promotedTypeParameterTypeNone2(T, neverQuestion));
120+
isNotBottom(promotedTypeParameterTypeQuestion2(T, neverQuestion));
123121

124122
// BOTTOM(X extends T) is true iff BOTTOM(T)
125-
T = typeParameter('T', bound: neverNone);
126-
isBottom(typeParameterTypeNone(T));
127-
isNotBottom(typeParameterTypeQuestion(T));
123+
T = typeParameter2('T', bound: neverNone);
124+
isBottom(typeParameterTypeNone2(T));
125+
isNotBottom(typeParameterTypeQuestion2(T));
128126

129-
T = typeParameter('T', bound: neverQuestion);
130-
isNotBottom(typeParameterTypeNone(T));
131-
isNotBottom(typeParameterTypeQuestion(T));
127+
T = typeParameter2('T', bound: neverQuestion);
128+
isNotBottom(typeParameterTypeNone2(T));
129+
isNotBottom(typeParameterTypeQuestion2(T));
132130

133131
// BOTTOM(T) is false otherwise
134132
isNotBottom(dynamicType);
@@ -141,12 +139,12 @@ class BoundsHelperPredicatesTest extends _BoundsTestBase {
141139
isNotBottom(intNone);
142140
isNotBottom(intQuestion);
143141

144-
T = typeParameter('T', bound: numNone);
145-
isNotBottom(typeParameterTypeNone(T));
146-
isNotBottom(typeParameterTypeQuestion(T));
142+
T = typeParameter2('T', bound: numNone);
143+
isNotBottom(typeParameterTypeNone2(T));
144+
isNotBottom(typeParameterTypeQuestion2(T));
147145

148-
isNotBottom(promotedTypeParameterTypeNone(T, intNone));
149-
isNotBottom(promotedTypeParameterTypeQuestion(T, intNone));
146+
isNotBottom(promotedTypeParameterTypeNone2(T, intNone));
147+
isNotBottom(promotedTypeParameterTypeQuestion2(T, intNone));
150148
}
151149

152150
test_isMoreBottom() {
@@ -510,29 +508,29 @@ class LowerBoundTest extends _BoundsTestBase {
510508
Map<String, TypeImpl> namedMap,
511509
Map<String, TypeImpl> namedRequiredMap,
512510
) {
513-
var parameters = <ParameterElement>[];
511+
var formalParameters = <FormalParameterElement>[];
514512

515513
for (var requiredType in requiredTypes) {
516-
parameters.add(
517-
requiredParameter(type: requiredType),
514+
formalParameters.add(
515+
requiredParameter2(type: requiredType),
518516
);
519517
}
520518

521519
for (var entry in namedMap.entries) {
522-
parameters.add(
523-
namedParameter(name: entry.key, type: entry.value),
520+
formalParameters.add(
521+
namedParameter2(name: entry.key, type: entry.value),
524522
);
525523
}
526524

527525
for (var entry in namedRequiredMap.entries) {
528-
parameters.add(
529-
namedRequiredParameter(name: entry.key, type: entry.value),
526+
formalParameters.add(
527+
namedRequiredParameter2(name: entry.key, type: entry.value),
530528
);
531529
}
532530

533-
return functionTypeNone(
531+
return functionTypeNone2(
534532
returnType: voidNone,
535-
parameters: parameters,
533+
parameters: formalParameters,
536534
);
537535
}
538536

@@ -612,23 +610,23 @@ class LowerBoundTest extends _BoundsTestBase {
612610
List<TypeImpl> requiredTypes,
613611
List<TypeImpl> positionalTypes,
614612
) {
615-
var parameters = <ParameterElement>[];
613+
var formalParameters = <FormalParameterElement>[];
616614

617615
for (var requiredType in requiredTypes) {
618-
parameters.add(
619-
requiredParameter(type: requiredType),
616+
formalParameters.add(
617+
requiredParameter2(type: requiredType),
620618
);
621619
}
622620

623621
for (var positionalType in positionalTypes) {
624-
parameters.add(
625-
positionalParameter(type: positionalType),
622+
formalParameters.add(
623+
positionalParameter2(type: positionalType),
626624
);
627625
}
628626

629-
return functionTypeNone(
627+
return functionTypeNone2(
630628
returnType: voidNone,
631-
parameters: parameters,
629+
parameters: formalParameters,
632630
);
633631
}
634632

0 commit comments

Comments
 (0)