Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor "could apply" logic for extensions #3847

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

srawlins
Copy link
Member

@srawlins srawlins commented Aug 26, 2024

This logic was implemented in a few places between Extension and ElementType (and subtypes). We don't need any logic to live in ElementTypes though, since any calculations that need to be made regarding DartTypes or InterfaceTypes can be made in Extension (alwaysApplies and couldApplyTo). This fixes #3846 and dramatically simplifies the implementation. Also:

  • Rename Extension.extendedType to Extension.extendedElement.
  • Change PackageGraph._extensions to a Set, to remove duplication in multiple canonical libraries.
  • Introduce a classes test.
  • Delete some redundant end2end testing code.
  • Thanks for your contribution! Please replace this text with a description of what this PR is changing or adding and why, list any relevant issues, and review the contribution guidelines below.

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

@srawlins
Copy link
Member Author

CC @dart-lang/analyzer-team

@srawlins srawlins mentioned this pull request Aug 26, 2024
1 task
This logic was implemented in a few places between Extension and ElementType (and subtypes). We don't need any logic to live in ElementTypes though, since any calculations that need to be made regarding DartTypes or InterfaceTypes can be made in Extension (`alwaysApplies` and `couldApplyTo`). This fixes dart-lang#3846 and dramatically simplifies the implementation. Also:

* Rename `Extension.extendedType` to `Extension.extendedElement`.
* Change `PackageGraph._extensions` to a Set, to remove duplication in multiple canonical libraries.
* Introduce a classes test.
* Delete some redundant end2end testing code.
@srawlins srawlins merged commit dc56630 into dart-lang:main Aug 27, 2024
9 checks passed
@srawlins srawlins deleted the refactor-extensions branch August 27, 2024 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

List page should contain FutureIterable as an available extension
3 participants