Skip to content

Commit f927877

Browse files
scheglovCommit Queue
authored andcommitted
CQ. Use more specific normalizeInterfaceType() and normalizeFunctionType().
Change-Id: I1985efbd2536ae7847050d441780e51ea74dccdb Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429860 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 4ef189a commit f927877

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

pkg/analyzer/lib/src/dart/element/class_hierarchy.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,11 @@ class _ClassInterfaceType {
175175
} else if (type == _singleType) {
176176
return;
177177
} else {
178-
_currentResult =
179-
_typeSystem.normalize(_singleType!) as InterfaceTypeImpl;
178+
_currentResult = _typeSystem.normalizeInterfaceType(_singleType!);
180179
}
181180
}
182181

183-
var normType = _typeSystem.normalize(type) as InterfaceTypeImpl;
182+
var normType = _typeSystem.normalizeInterfaceType(type);
184183
try {
185184
_currentResult = _merge(_currentResult!, normType);
186185
} catch (e) {

pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1183,7 +1183,7 @@ class InheritanceManager3 {
11831183

11841184
var resultType = validOverrides
11851185
.map((e) {
1186-
return typeSystem.normalize(e.type) as FunctionTypeImpl;
1186+
return typeSystem.normalizeFunctionType(e.type);
11871187
})
11881188
.reduce((previous, next) {
11891189
return typeSystem.topMerge(previous, next) as FunctionTypeImpl;

pkg/analyzer/lib/src/dart/element/normalize.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ class NormalizeHelper {
2929
return _normalize(T);
3030
}
3131

32+
FunctionTypeImpl normalizeFunctionType(FunctionTypeImpl T) {
33+
return _normalize(T) as FunctionTypeImpl;
34+
}
35+
36+
InterfaceTypeImpl normalizeInterfaceType(InterfaceTypeImpl T) {
37+
return _normalize(T) as InterfaceTypeImpl;
38+
}
39+
3240
/// `NORM(R Function<X extends B>(S)) = R1 Function(X extends B1>(S1)`
3341
/// * where R1 = NORM(R)
3442
/// * and B1 = NORM(B)

pkg/analyzer/lib/src/dart/element/type_system.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,6 +1477,14 @@ class TypeSystemImpl implements TypeSystem {
14771477
return NormalizeHelper(this).normalize(T);
14781478
}
14791479

1480+
FunctionTypeImpl normalizeFunctionType(FunctionTypeImpl T) {
1481+
return NormalizeHelper(this).normalizeFunctionType(T);
1482+
}
1483+
1484+
InterfaceTypeImpl normalizeInterfaceType(InterfaceTypeImpl T) {
1485+
return NormalizeHelper(this).normalizeInterfaceType(T);
1486+
}
1487+
14801488
/// Returns a non-nullable version of [type]. This is equivalent to the
14811489
/// operation `NonNull` defined in the spec.
14821490
@override

0 commit comments

Comments
 (0)