-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Sema] Don't check availability in assigned properties initializers for -check-api-availaiblity-only mode #39847
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
@swift-ci Please smoke test |
cc @davidungar for your interest in availability issues. This is part of the work started in #39640 that introduced a mode to check the availability of the public API only. This is to be used when we are not generating a binary but only the module files including swiftinterfaces. |
Thanks for thinking of me. I haven't looked at it yet but right off the bat, it would help if the summary clarified the purpose of the PR. Is it to speed up compilation in a certain scenario? Or is it to improve type checking in some other way? |
LGTM |
@davidungar The |
Currently some of these projects disable availability checking all together, which is very very bad. This mode should be more appropriate to their needs, raising only errors relevant to their use cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me!
20be277
to
8254808
Compare
For a non-public property where the type is defined by an assignment, like `internal var internalAssigned = NewStruct()`, type-checking the type's availability is done via checking the initializer expression. In -check-api-availaiblity-only mode, pass down a flag to not check availability in expressions for initializer expressions of such non-public properties. rdar://84389825
8254808
to
d2ec6b9
Compare
This is a different implementation. Skipping the whole type checking lead to errors at serialization as skipping function bodies doesn't skip property initialization. Instead, let's pass down a flag to disable availability checking in expression when type-checking the property initializer. @swift-ci Please smoke test |
@swift-ci Please smoke test Linux |
For a non-public property where the type is defined by an assignment, like
internal var internalAssigned = NewStruct()
, type-checking the type's availability is done via checking the initializer expression.In -check-api-availaiblity-only mode, pass down a flag to not check availability in expressions for initializer expressions of such non-public properties.
To make sure this doesn't have unintended side-effects on generated code, forbid IR generation when the flag
-check-api-availaiblity-only
is used.rdar://84389825
Followup to #39640.