[analyzer] Use InterfaceTypeImpl when interfacing with shared code
Change the analyzer's use of the following generic types so that it
supplies the type parameter `InterfaceTypeImpl` instead of
`InterfaceType` as the type it uses to represent interface types:
- `MergedTypeConstraint`
- `TypeAnalyzer`
- `TypeAnalyzerOperations`
- `TypeAnalyzerOperationsMixin`
- `TypeConstraintFromArgument`
- `TypeConstraintFromExtendsClause`
- `TypeConstraintFromFunctionContext`
- `TypeConstraintFromReturnType`
- `TypeConstraintGenerator`
- `TypeConstraintGeneratorMixin`
- `TypeConstraintOrigin`
- `TypeDeclarationMatchResult`
- `UnknownTypeConstraintOrigin`
This is part of a larger arc of work to change the analyzer's use of
the shared code so that the type parameters it supplies are not part
of the analyzer public API. See
https://github.com/dart-lang/sdk/issues/59763.
Change-Id: Id286f1f9ada4a0a516d8cb8e03b32caf10d626c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403141
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
diff --git a/pkg/analyzer/lib/src/dart/element/type_constraint_gatherer.dart b/pkg/analyzer/lib/src/dart/element/type_constraint_gatherer.dart
index 02d08a5..2d4829e 100644
--- a/pkg/analyzer/lib/src/dart/element/type_constraint_gatherer.dart
+++ b/pkg/analyzer/lib/src/dart/element/type_constraint_gatherer.dart
@@ -37,7 +37,7 @@
DartType,
TypeParameterElementImpl2,
PromotableElementImpl2,
- InterfaceType,
+ InterfaceTypeImpl,
InterfaceElementImpl2>;
/// Instance of [shared.TypeConstraintFromArgument] specific to the Analyzer.
@@ -45,13 +45,13 @@
DartType,
PromotableElementImpl2,
TypeParameterElementImpl2,
- InterfaceType,
+ InterfaceTypeImpl,
InterfaceElementImpl2>;
/// Instance of [shared.TypeConstraintFromExtendsClause] specific to the Analyzer.
typedef TypeConstraintFromExtendsClause
= shared.TypeConstraintFromExtendsClause<DartType, PromotableElementImpl2,
- TypeParameterElementImpl2, InterfaceType, InterfaceElementImpl2>;
+ TypeParameterElementImpl2, InterfaceTypeImpl, InterfaceElementImpl2>;
/// Instance of [shared.TypeConstraintFromFunctionContext] specific to the Analyzer.
typedef TypeConstraintFromFunctionContext
@@ -61,7 +61,7 @@
DartType,
PromotableElementImpl2,
TypeParameterElementImpl2,
- InterfaceType,
+ InterfaceTypeImpl,
InterfaceElementImpl2>;
/// Instance of [shared.TypeConstraintFromReturnType] specific to the Analyzer.
@@ -71,7 +71,7 @@
DartType,
PromotableElementImpl2,
TypeParameterElementImpl2,
- InterfaceType,
+ InterfaceTypeImpl,
InterfaceElementImpl2>;
/// Instance of [shared.TypeConstraintOrigin] specific to the Analyzer.
@@ -79,7 +79,7 @@
DartType,
PromotableElementImpl2,
TypeParameterElementImpl2,
- InterfaceType,
+ InterfaceTypeImpl,
InterfaceElementImpl2>;
/// Instance of [shared.UnknownTypeConstraintOrigin] specific to the Analyzer.
@@ -87,7 +87,7 @@
DartType,
PromotableElementImpl2,
TypeParameterElementImpl2,
- InterfaceType,
+ InterfaceTypeImpl,
InterfaceElementImpl2>;
/// Creates sets of [GeneratedTypeConstraint]s for type parameters, based on an
@@ -97,7 +97,7 @@
FormalParameterElementOrMember,
PromotableElementImpl2,
TypeParameterElementImpl2,
- InterfaceType,
+ InterfaceTypeImpl,
InterfaceElementImpl2,
AstNode>
with
@@ -106,7 +106,7 @@
FormalParameterElementOrMember,
PromotableElementImpl2,
TypeParameterElementImpl2,
- InterfaceType,
+ InterfaceTypeImpl,
InterfaceElementImpl2,
AstNode> {
@override
diff --git a/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart b/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart
index 8dd1dc3..01b41a3 100644
--- a/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart
@@ -424,10 +424,14 @@
class TypeSystemOperations
with
TypeAnalyzerOperationsMixin<DartType, PromotableElementImpl2,
- TypeParameterElementImpl2, InterfaceType, InterfaceElementImpl2>
+ TypeParameterElementImpl2, InterfaceTypeImpl, InterfaceElementImpl2>
implements
- TypeAnalyzerOperations<DartType, PromotableElementImpl2,
- TypeParameterElementImpl2, InterfaceType, InterfaceElementImpl2> {
+ TypeAnalyzerOperations<
+ DartType,
+ PromotableElementImpl2,
+ TypeParameterElementImpl2,
+ InterfaceTypeImpl,
+ InterfaceElementImpl2> {
final bool strictCasts;
final TypeSystemImpl typeSystem;
@@ -738,8 +742,8 @@
}
@override
- TypeDeclarationMatchResult<InterfaceType, InterfaceElementImpl2, DartType>?
- matchTypeDeclarationTypeInternal(DartType type) {
+ TypeDeclarationMatchResult<InterfaceTypeImpl, InterfaceElementImpl2,
+ DartType>? matchTypeDeclarationTypeInternal(DartType type) {
if (isInterfaceTypeInternal(type)) {
InterfaceTypeImpl interfaceType = type as InterfaceTypeImpl;
return TypeDeclarationMatchResult(
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 92ea1b9..4f75d3fe 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -129,7 +129,7 @@
DartPattern,
void,
TypeParameterElementImpl2,
- InterfaceType,
+ InterfaceTypeImpl,
InterfaceElementImpl2>,
// TODO(paulberry): not yet used.
NullShortingMixin<Null, Expression, SharedTypeView<DartType>> {
@@ -456,7 +456,7 @@
DartType,
PromotableElementImpl2,
TypeParameterElementImpl2,
- InterfaceType,
+ InterfaceTypeImpl,
InterfaceElementImpl2> get operations => flowAnalysis.typeOperations;
/// Gets the current depth of the [_rewriteStack]. This may be used in