Skip to content

Conversation

aviralg
Copy link

@aviralg aviralg commented Oct 4, 2025

This commit introduces a performance hint check that warns on the use of existential any in variable declarations, function and closure parameters and return, and typealiases.

@aviralg
Copy link
Author

aviralg commented Oct 4, 2025

@swift-ci test

This commit introduces a performance hint check that warns on the use of
existential any in variable declarations, function and closure parameters and
return, and typealiases.
@aviralg aviralg force-pushed the perf-hint/existential-any branch from 7217eb3 to 13a5c2d Compare October 5, 2025 02:11
@aviralg aviralg marked this pull request as ready for review October 5, 2025 02:21
@aviralg
Copy link
Author

aviralg commented Oct 5, 2025

@swift-ci test

return true;
}

bool visitTupleType(TupleType *TT) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using TypeVisitor for this is incorrect because you're going to miss a lot of cases. For example, a nominal type might have a parent, which you're not visiting at all:

struct Outer<T> {
  struct Inner {}
}

Outer<any P>.Inner

Please use Type.findIf() or Type.visit() instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #8ab27f Thanks for the example, added it as a test case.

@aviralg
Copy link
Author

aviralg commented Oct 6, 2025

@swift-ci test

@aviralg aviralg requested review from slavapestov and artemcm October 6, 2025 20:40
@aviralg aviralg requested a review from artemcm October 6, 2025 21:37
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.

3 participants