Skip to content

Commit 57771cd

Browse files
scheglovCommit Queue
authored andcommitted
Fine. Use ManifestFunctionType for setter items.
Switch setter manifest entries from a single `valueType` to the full `ManifestFunctionType`. This captures parameter covariantness and metadata, which were previously omitted, and aligns setters with methods and constructors that already use function types. Key changes: - Encode and match setter items using `element.type` (function type) rather than `valueFormalParameter.type`. - Serialize setters via `functionType.writeNoTag(...)` and read with `ManifestFunctionType.read(...)`. - Update the result printer to display `functionType` for setters. - Bump `AnalysisDriver.DATA_VERSION` to invalidate incompatible caches. Why: Recording the full function signature ensures that manifest IDs change when parameter covariance or annotations change, improving fidelity of fine-grained dependency tracking and reuse decisions. The representation is now consistent across executable members. Impact: Slight increase in serialized size and comparison work for setters; expected to be negligible. No behavioral changes to analysis, only more accurate change detection and manifest output. Change-Id: I2a753d0cf0d41176f46683e5f4a30e432f968d8c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/448060 Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Johnni Winther <[email protected]> Reviewed-by: Paul Berry <[email protected]>
1 parent 9fb8440 commit 57771cd

File tree

4 files changed

+275
-53
lines changed

4 files changed

+275
-53
lines changed

pkg/analyzer/lib/src/dart/analysis/driver.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ testFineAfterLibraryAnalyzerHook;
106106
// TODO(scheglov): Clean up the list of implicitly analyzed files.
107107
class AnalysisDriver {
108108
/// The version of data format, should be incremented on every format change.
109-
static const int DATA_VERSION = 533;
109+
static const int DATA_VERSION = 534;
110110

111111
/// The number of exception contexts allowed to write. Once this field is
112112
/// zero, we stop writing any new exception contexts in this process.

pkg/analyzer/lib/src/fine/manifest_item.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -845,13 +845,13 @@ class InstanceItemMethodItem extends InstanceItemMemberItem<MethodElementImpl> {
845845
}
846846

847847
class InstanceItemSetterItem extends InstanceItemMemberItem<SetterElementImpl> {
848-
final ManifestType valueType;
848+
final ManifestFunctionType functionType;
849849

850850
InstanceItemSetterItem({
851851
required super.id,
852852
required super.metadata,
853853
required super.isStatic,
854-
required this.valueType,
854+
required this.functionType,
855855
});
856856

857857
factory InstanceItemSetterItem.fromElement({
@@ -866,7 +866,7 @@ class InstanceItemSetterItem extends InstanceItemMemberItem<SetterElementImpl> {
866866
element.thisOrVariableMetadata,
867867
),
868868
isStatic: element.isStatic,
869-
valueType: element.valueFormalParameter.type.encode(context),
869+
functionType: element.type.encode(context),
870870
);
871871
}
872872

@@ -875,20 +875,20 @@ class InstanceItemSetterItem extends InstanceItemMemberItem<SetterElementImpl> {
875875
id: ManifestItemId.read(reader),
876876
metadata: ManifestMetadata.read(reader),
877877
isStatic: reader.readBool(),
878-
valueType: ManifestType.read(reader),
878+
functionType: ManifestFunctionType.read(reader),
879879
);
880880
}
881881

882882
@override
883883
bool match(MatchContext context, SetterElementImpl element) {
884884
return super.match(context, element) &&
885-
valueType.match(context, element.valueFormalParameter.type);
885+
functionType.match(context, element.type);
886886
}
887887

888888
@override
889889
void write(BufferedSink sink) {
890890
super.write(sink);
891-
valueType.write(sink);
891+
functionType.writeNoTag(sink);
892892
}
893893

894894
@override

0 commit comments

Comments
 (0)