Skip to content

Commit 29a9b4f

Browse files
stereotype441Commit Queue
authored andcommitted
[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 #59763. Change-Id: Id286f1f9ada4a0a516d8cb8e03b32caf10d626c7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403141 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Paul Berry <[email protected]>
1 parent e4dceb3 commit 29a9b4f

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,21 @@ typedef MergedTypeConstraint = shared.MergedTypeConstraint<
3737
DartType,
3838
TypeParameterElementImpl2,
3939
PromotableElementImpl2,
40-
InterfaceType,
40+
InterfaceTypeImpl,
4141
InterfaceElementImpl2>;
4242

4343
/// Instance of [shared.TypeConstraintFromArgument] specific to the Analyzer.
4444
typedef TypeConstraintFromArgument = shared.TypeConstraintFromArgument<
4545
DartType,
4646
PromotableElementImpl2,
4747
TypeParameterElementImpl2,
48-
InterfaceType,
48+
InterfaceTypeImpl,
4949
InterfaceElementImpl2>;
5050

5151
/// Instance of [shared.TypeConstraintFromExtendsClause] specific to the Analyzer.
5252
typedef TypeConstraintFromExtendsClause
5353
= shared.TypeConstraintFromExtendsClause<DartType, PromotableElementImpl2,
54-
TypeParameterElementImpl2, InterfaceType, InterfaceElementImpl2>;
54+
TypeParameterElementImpl2, InterfaceTypeImpl, InterfaceElementImpl2>;
5555

5656
/// Instance of [shared.TypeConstraintFromFunctionContext] specific to the Analyzer.
5757
typedef TypeConstraintFromFunctionContext
@@ -61,7 +61,7 @@ typedef TypeConstraintFromFunctionContext
6161
DartType,
6262
PromotableElementImpl2,
6363
TypeParameterElementImpl2,
64-
InterfaceType,
64+
InterfaceTypeImpl,
6565
InterfaceElementImpl2>;
6666

6767
/// Instance of [shared.TypeConstraintFromReturnType] specific to the Analyzer.
@@ -71,23 +71,23 @@ typedef TypeConstraintFromReturnType = shared.TypeConstraintFromReturnType<
7171
DartType,
7272
PromotableElementImpl2,
7373
TypeParameterElementImpl2,
74-
InterfaceType,
74+
InterfaceTypeImpl,
7575
InterfaceElementImpl2>;
7676

7777
/// Instance of [shared.TypeConstraintOrigin] specific to the Analyzer.
7878
typedef TypeConstraintOrigin = shared.TypeConstraintOrigin<
7979
DartType,
8080
PromotableElementImpl2,
8181
TypeParameterElementImpl2,
82-
InterfaceType,
82+
InterfaceTypeImpl,
8383
InterfaceElementImpl2>;
8484

8585
/// Instance of [shared.UnknownTypeConstraintOrigin] specific to the Analyzer.
8686
typedef UnknownTypeConstraintOrigin = shared.UnknownTypeConstraintOrigin<
8787
DartType,
8888
PromotableElementImpl2,
8989
TypeParameterElementImpl2,
90-
InterfaceType,
90+
InterfaceTypeImpl,
9191
InterfaceElementImpl2>;
9292

9393
/// Creates sets of [GeneratedTypeConstraint]s for type parameters, based on an
@@ -97,7 +97,7 @@ class TypeConstraintGatherer extends shared.TypeConstraintGenerator<
9797
FormalParameterElementOrMember,
9898
PromotableElementImpl2,
9999
TypeParameterElementImpl2,
100-
InterfaceType,
100+
InterfaceTypeImpl,
101101
InterfaceElementImpl2,
102102
AstNode>
103103
with
@@ -106,7 +106,7 @@ class TypeConstraintGatherer extends shared.TypeConstraintGenerator<
106106
FormalParameterElementOrMember,
107107
PromotableElementImpl2,
108108
TypeParameterElementImpl2,
109-
InterfaceType,
109+
InterfaceTypeImpl,
110110
InterfaceElementImpl2,
111111
AstNode> {
112112
@override

pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,14 @@ class FlowAnalysisHelper {
424424
class TypeSystemOperations
425425
with
426426
TypeAnalyzerOperationsMixin<DartType, PromotableElementImpl2,
427-
TypeParameterElementImpl2, InterfaceType, InterfaceElementImpl2>
427+
TypeParameterElementImpl2, InterfaceTypeImpl, InterfaceElementImpl2>
428428
implements
429-
TypeAnalyzerOperations<DartType, PromotableElementImpl2,
430-
TypeParameterElementImpl2, InterfaceType, InterfaceElementImpl2> {
429+
TypeAnalyzerOperations<
430+
DartType,
431+
PromotableElementImpl2,
432+
TypeParameterElementImpl2,
433+
InterfaceTypeImpl,
434+
InterfaceElementImpl2> {
431435
final bool strictCasts;
432436
final TypeSystemImpl typeSystem;
433437

@@ -738,8 +742,8 @@ class TypeSystemOperations
738742
}
739743

740744
@override
741-
TypeDeclarationMatchResult<InterfaceType, InterfaceElementImpl2, DartType>?
742-
matchTypeDeclarationTypeInternal(DartType type) {
745+
TypeDeclarationMatchResult<InterfaceTypeImpl, InterfaceElementImpl2,
746+
DartType>? matchTypeDeclarationTypeInternal(DartType type) {
743747
if (isInterfaceTypeInternal(type)) {
744748
InterfaceTypeImpl interfaceType = type as InterfaceTypeImpl;
745749
return TypeDeclarationMatchResult(

pkg/analyzer/lib/src/generated/resolver.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class ResolverVisitor extends ThrowingAstVisitor<void>
129129
DartPattern,
130130
void,
131131
TypeParameterElementImpl2,
132-
InterfaceType,
132+
InterfaceTypeImpl,
133133
InterfaceElementImpl2>,
134134
// TODO(paulberry): not yet used.
135135
NullShortingMixin<Null, Expression, SharedTypeView<DartType>> {
@@ -456,7 +456,7 @@ class ResolverVisitor extends ThrowingAstVisitor<void>
456456
DartType,
457457
PromotableElementImpl2,
458458
TypeParameterElementImpl2,
459-
InterfaceType,
459+
InterfaceTypeImpl,
460460
InterfaceElementImpl2> get operations => flowAnalysis.typeOperations;
461461

462462
/// Gets the current depth of the [_rewriteStack]. This may be used in

0 commit comments

Comments
 (0)