Skip to content

Sema: Allow some references to declarations that are unavailable-in-Swift #70708

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 Jan 4, 2024

Swift generates implicit constructors for inherited designated initializers in case some implicit initialization (such as running property initializer expressions) needs to run after calling the initializer on the superclass. These implicit initializers are printed in .swiftinterfaces and previously they could cause the interface to fail to typecheck when one of the parameters is declared to be unavailable-in-Swift. These initializers need to be generated because they may be called from Objective-C where the unavailable-in-Swift designation is irrelevant. To account for this possibility, relax availability checking to allow this narrow exception only in .swiftinterfaces.

Another possible but more complicated solution would be to print the initializers with an attribute that indicates that the initializer is inherited and implicit. This would allow the typechecking exception to be more precise but seems unnecessarily complicated given that the exception is only needed in .swiftinterfaces, which are already compiler generated.

Resolves rdar://77221357

…wift.

Swift generates implicit constructors for inherited designated initializers in
case some implicit initialization (such as running property initializer
expressions) needs to run after calling the initializer on the superclass.
These implicit initializers are printed in .swiftinterfaces and previously they
could cause the interface to fail to typecheck when one of the parameters is
declared to be unavailable-in-Swift. These initializers need to be generated
because they may be called from Objective-C where the unavailable-in-Swift
designation is irrelevant. To account for this possibility, relax availability
checking to allow this narrow exception only in .swiftinterfaces.

Another possible but more complicated solution would be to print the
initializers with an attribute that indicates that the initializer is inherited
and implicit. This would allow the typechecking exception to be more precise
but seems unnecessarily complicated given that the exception is only needed in
.swiftinterfaces, which are already compiler generated.

Resolves rdar://77221357
@tshortli
Copy link
Contributor Author

tshortli commented Jan 4, 2024

@swift-ci please smoke test

@tshortli tshortli merged commit 2d6eabf into swiftlang:main Jan 4, 2024
@tshortli tshortli deleted the module-interface-allow-inherited-objc-inits-with-unavailable-in-swift-params branch January 4, 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.

2 participants