CQ. Use more specific normalizeInterfaceType() and normalizeFunctionType().
Change-Id: I1985efbd2536ae7847050d441780e51ea74dccdb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/src/dart/element/class_hierarchy.dart b/pkg/analyzer/lib/src/dart/element/class_hierarchy.dart
index a5ecc22..9d55bdc 100644
--- a/pkg/analyzer/lib/src/dart/element/class_hierarchy.dart
+++ b/pkg/analyzer/lib/src/dart/element/class_hierarchy.dart
@@ -175,12 +175,11 @@
} else if (type == _singleType) {
return;
} else {
- _currentResult =
- _typeSystem.normalize(_singleType!) as InterfaceTypeImpl;
+ _currentResult = _typeSystem.normalizeInterfaceType(_singleType!);
}
}
- var normType = _typeSystem.normalize(type) as InterfaceTypeImpl;
+ var normType = _typeSystem.normalizeInterfaceType(type);
try {
_currentResult = _merge(_currentResult!, normType);
} catch (e) {
diff --git a/pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart b/pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart
index 40a85bd..ce4ab23 100644
--- a/pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart
+++ b/pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart
@@ -1183,7 +1183,7 @@
var resultType = validOverrides
.map((e) {
- return typeSystem.normalize(e.type) as FunctionTypeImpl;
+ return typeSystem.normalizeFunctionType(e.type);
})
.reduce((previous, next) {
return typeSystem.topMerge(previous, next) as FunctionTypeImpl;
diff --git a/pkg/analyzer/lib/src/dart/element/normalize.dart b/pkg/analyzer/lib/src/dart/element/normalize.dart
index 08b9c63..cf70294 100644
--- a/pkg/analyzer/lib/src/dart/element/normalize.dart
+++ b/pkg/analyzer/lib/src/dart/element/normalize.dart
@@ -29,6 +29,14 @@
return _normalize(T);
}
+ FunctionTypeImpl normalizeFunctionType(FunctionTypeImpl T) {
+ return _normalize(T) as FunctionTypeImpl;
+ }
+
+ InterfaceTypeImpl normalizeInterfaceType(InterfaceTypeImpl T) {
+ return _normalize(T) as InterfaceTypeImpl;
+ }
+
/// `NORM(R Function<X extends B>(S)) = R1 Function(X extends B1>(S1)`
/// * where R1 = NORM(R)
/// * and B1 = NORM(B)
diff --git a/pkg/analyzer/lib/src/dart/element/type_system.dart b/pkg/analyzer/lib/src/dart/element/type_system.dart
index c533ca4..c2c6d4e 100644
--- a/pkg/analyzer/lib/src/dart/element/type_system.dart
+++ b/pkg/analyzer/lib/src/dart/element/type_system.dart
@@ -1477,6 +1477,14 @@
return NormalizeHelper(this).normalize(T);
}
+ FunctionTypeImpl normalizeFunctionType(FunctionTypeImpl T) {
+ return NormalizeHelper(this).normalizeFunctionType(T);
+ }
+
+ InterfaceTypeImpl normalizeInterfaceType(InterfaceTypeImpl T) {
+ return NormalizeHelper(this).normalizeInterfaceType(T);
+ }
+
/// Returns a non-nullable version of [type]. This is equivalent to the
/// operation `NonNull` defined in the spec.
@override