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

fix(filter) : remove imports of filtered types #683

Merged
merged 4 commits into from
Aug 11, 2023
Merged

Conversation

dselman
Copy link
Contributor

@dselman dselman commented Aug 11, 2023

Closes #682

Updates the BaseModelManager.filter method to update all the imports in the model manager based on the types that were removed by calls to ModelFiler.filter.

Changes

  • ModelFile.filter method updated to return an array of the types that were removed by the filter predicate
  • BaseModelManager.filter method updated to remove imports of removed types
  • Unit test

Flags

  • The change to ModelFile.filter to take removedDeclarations as an extra argument is technically a breaking change however if we assume that the only caller of this function is BaseModelManager then we could argue that this is a pure bug fix.
  • I'm uncertain about this behaviour: ModelFiles with no declarations after filtering will be removed. — I suspect this could break wildcard imports when Concerto is used with strict:false. I'm choosing to ignore this given folks should be using strict:true and the likelihood that they are not and also using filter is small.

Screenshots or Video

Related Issues

  • Issue #
  • Pull Request #

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option of git commit.
  • Vital features and changes captured in unit and/or integration tests
  • Commits messages follow AP format
  • Extend the documentation, if necessary
  • Merging to main from fork:branchname

@dselman dselman requested review from a team and mttrbrts August 11, 2023 11:32
@dselman dselman merged commit c368b60 into main Aug 11, 2023
@dselman dselman deleted the ds-fix-filter-imports branch August 11, 2023 16:28
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.

ModelFile.filter does not update imports
2 participants