Skip to content

AST: Filter out some Obj-C overrides when MemberImportVisibility is enabled #81089

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

Conversation

tshortli
Copy link
Contributor

@tshortli tshortli commented Apr 25, 2025

Unlike in Swift, Obj-C allows method overrides to be declared in extensions (categories), even outside of the module that defines the type that is being extended. When MemberImportVisibility is enabled, these overrides must be filtered out to prevent them from hijacking name lookup and causing the compiler to insist that the module that defines the extension be imported.

This is a second attempt of #80563. This time, removeOverriddenDecls() has been updated to consistently traverse the entire chain of overridden methods to account for gaps created by filtering.

Resolves rdar://145329988.

@tshortli
Copy link
Contributor Author

@swift-ci please test

@tshortli tshortli force-pushed the member-import-visibility-objc-overloads-in-extensions-take-2 branch from b54573f to 13cffde Compare April 25, 2025 05:55
@tshortli
Copy link
Contributor Author

@swift-ci please test

@tshortli tshortli enabled auto-merge April 25, 2025 05:59
…nabled.

Unlike in Swift, Obj-C allows method overrides to be declared in extensions
(categories), even outside of the module that defines the type that is being
extended. When MemberImportVisibility is enabled, these overrides must be
filtered out to prevent them from hijacking name lookup and causing the
compiler to insist that the module that defines the extension be imported.

Resolves rdar://145329988.
@tshortli tshortli force-pushed the member-import-visibility-objc-overloads-in-extensions-take-2 branch from 13cffde to 039974a Compare April 25, 2025 15:05
@tshortli
Copy link
Contributor Author

@swift-ci please smoke test

@tshortli
Copy link
Contributor Author

@swift-ci please smoke test macOS

@tshortli tshortli merged commit 3e43020 into swiftlang:main Apr 26, 2025
3 checks passed
@tshortli tshortli deleted the member-import-visibility-objc-overloads-in-extensions-take-2 branch April 26, 2025 04:25
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.

1 participant