Files
sdk/pkg/analyzer/test/generated
Paul Berry 0931a604a6 [analyzer] Use FormalParameterElementOrMember when interfacing with shared code.
Change the analyzer's use of the following shared generic types so
that it supplies the type parameter `FormalParameterElementOrMember`
instead of `ParameterElementMixin` as the type it uses to represent
parameters of function types:

- `SharedFunctionTypeStructure`
- `TypeConstraintGenerator`
- `TypeConstraintGeneratorMixin`

`FormalParameterElementOrMember` is a new interface class that acts as
a common private base class for all the concrete subtypes of the
public API class `FormalParameterElement`.

This required adding a type cast in one place (in
`FunctionTypeImpl.sortedNamedParametersShared`). In other places, I
avoided type casts by tightening up some return types (for example,
`FieldFormalParameterElementImpl.element` now returns
`FieldFormalParameterElementImpl2` instead of
`FieldFormalParameterElement2`). The analyzer public API is unchanged,
though (for example, `FieldFormalParameterFragment.element` still has
a return type of `FieldFormalParameterElement2`), so clients should be
unaffected.

As a result of this change, it is no longer necessary for
`ParameterElementMixin` to implement the shared interface
`SharedNamedFunctionParameterStructure`. This interface is now
implemented by `FormalParameterElementOrMember`.

This is part of a larger arc of work to use types from the new
analyzer element model when interfacing with shared code.

Change-Id: I1ab5bf0607a80cbe30f4814bd5444487099825ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402341
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-01-06 11:06:39 -08:00
..