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
Elements. Infer type arguments for redirected generic factory constructors.
Fix element model building to infer type arguments for redirected
factory constructors of generic classes (both named and unnamed). This
brings element construction in line with AST resolution so redirected
targets carry the correct type substitutions instead of defaulting to
uninstantiated or incorrect types.
What changed:
- Perform generic inference when resolving the redirect target type in
`NamedTypeResolver`, using the enclosing class as context.
- Replace the brittle `redirectedConstructor_namedType` tracking with
structural detection of redirecting constructor contexts.
- Ensure `ResolutionVisitor` provides the enclosing class to the type
resolver and visit the redirection directly.
- Adjust `AstResolver` ordering so enclosing declaration info is set
before resolving constructor children.
- Bump `DATA_VERSION` to invalidate stale serialized data.
Why:
- Previously, only AST resolution performed inference. Element model
building skipped it, producing incorrect constructor redirections in
summaries and downstream analyses. Aligning both paths fixes those
inconsistencies.
Impact:
- Correct substitutions are recorded for redirected constructors in
summaries; no public API changes expected.
- Adds targeted tests to prevent regressions (no behavioral changes
beyond the intended inference fix).
Fixes: flutter/flutter#174503
Bug: flutter/flutter#174503
Change-Id: If231de40de9af15ec14dc26cda28bdc269d9896e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/447603
Commit-Queue: Konstantin Shcheglov <[email protected]>
Reviewed-by: Paul Berry <[email protected]>
0 commit comments