You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fine. Record and match type-parameter variance in manifests.
Capture declaration-site variance for generic declarations in the fine
manifests and use it during matching. Previously, manifests ignored
variance, so declarations that differed only by variance could be
incorrectly considered equivalent (or vice versa). Including variance
closes that correctness gap and prevents unstable reuse decisions.
Key changes:
- Encode variance on each ManifestTypeParameter (using shared.Variance)
and persist it in the wire format (written before the bound).
- Compare variance when matching type parameters, affecting classes,
mixins, function types, and type aliases.
- Consider type parameters when matching TypeAliasItem to avoid
false-positive matches of otherwise identical aliases.
- Switch withTypeParameters and match sites to work with
TypeParameterElementImpl so variance is available everywhere.
- Update the result printer to display type-parameter variance with
ordinal indices.
- Bump AnalysisDriver.DATA_VERSION to 531 to invalidate stale caches.
Notes:
- Default (implicit) covariant parameters and explicit `out` parameters
are treated equivalently, ensuring stable IDs in that case.
- This is an internal format change; no public API surface is altered.
Rationale: Storing and matching variance makes manifest-based reuse
sensitive to a semantically observable part of generic APIs. This yields
more accurate incremental analysis decisions and avoids reusing results
across variance-incompatible declarations.
Change-Id: I397016773c2bae8b7e588dd2b5cbdee303bbfb91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/447945
Commit-Queue: Konstantin Shcheglov <[email protected]>
Reviewed-by: Johnni Winther <[email protected]>
0 commit comments