-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Use AbstractStorageDecl::isSettableInSwift
to prohibit direct writes to optional
requirements
#42455
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
Use AbstractStorageDecl::isSettableInSwift
to prohibit direct writes to optional
requirements
#42455
Conversation
a32a8d4
to
ecf865d
Compare
@swift-ci Please test |
Hi Anthony! I'm the one who's been making the minimized cases Joe's been sharing—happy to report this seems to fix the actual crashes in the project I've been minimizing cases from. |
Glad to hear. Sorry for the trouble! |
ecf865d
to
a5077e4
Compare
Switched to |
@@ -0,0 +1,12 @@ | |||
// RUN: %target-swift-emit-silgen -import-objc-header %swift_src_root/test/Inputs/ObjCOptionalRequirements.h %s | %FileCheck %s | |||
|
|||
// REQUIRES: objc_interop |
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.
What are the criteria for REQUIRES: objc_interop
? Could tests like these simply -enable-objc-interop
?
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.
Apparently linux is not happy with -enable-objc-interop
when importing a header, even though the test passed when an Objective-C module was being imported instead.
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.
REQUIRES: objc_interop
is enabled when the target runtime is built with ObjC interop, which is practically only on Apple platforms. -enable-objc-interop
's behavior is only maintained on those platforms, so I don't think it makes sense to try to test it when running tests for target platforms that don't have ObjC interop.
@swift-ci please test |
a5077e4
to
f27b316
Compare
…s to `optional` requirements Stop pretending that an optional requirement is immutable via the `StorageImplInfo` request. This approach has lead astray the conformance checker and may have had a negative impact on other code paths, and it doesn't work for imported declarations because they bypass the request. Instead, use a forwarding `AbstractStorageDecl::isSettableInSwift` method that special-cases optional requirements.
f27b316
to
934964d
Compare
@swift-ci please test |
Stop pretending that an optional requirement is immutable via the
StorageImplInfo
request. This approach has lead astray the conformance checker and may have had a negative impact on other code paths that expectisSettable
orsupportsMutation
to mean "has a setter", and it doesn't work for imported declarations because they bypass the request. Instead, use a forwardingAbstractStorageDecl::isSettableInSwift
method that special-cases optional requirements.