Files
sdk/pkg/analyzer/test/generated
Konstantin Shcheglov bf0f72ae14 CQ. Refactor test type construction to use parseType().
Replace manual type construction utilities in type system tests with a
unified string-based type parser. This simplifies test code, improves
readability, and enables more expressive type scenarios.

Key changes:
- Introduce TypeSpecParser and TypeParsingScope to parse types,
  function types, records, and type parameters from strings.
- Add parseType() and related helpers to AbstractTypeSystemTest,
  replacing ElementsTypesMixin usage.
- Remove ElementsTypesMixin and migrate all tests to use parsed
  types instead of manually constructed TypeImpl instances.
- Extend _SpecParser to support:
  - Promoted type parameter bounds (`T & int`)
  - Parenthesized vs record types disambiguation
  - Additional built-in types (InvalidType, UnknownInferredType)
  - Variance in generic function types
  - Covariant parameters
- Refactor scope construction to use _Scope.forLibraries, reducing
  duplicated interface/type alias collection logic.
- Add standalone materialization flow for type parameters to support
  parsing in isolation.

Impact:
- Tests become more declarative and closer to Dart syntax.
- Eliminates boilerplate and reduces risk of inconsistencies in
  manual type construction.
- Enables testing of newer type system features (promotion,
  variance, complex function types) via concise string specs.

Change-Id: I85dd0aa88a37142356f14419d0d35350e38b9c8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497680
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-04-24 09:21:11 -07:00
..