-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[ClangImporter] Don't import accessors of constants as 'open' if they're static #80940
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 test |
@swift-ci please test source compatibility |
@@ -426,7 +426,8 @@ ValueDecl *SwiftDeclSynthesizer::createConstant(Identifier name, | |||
/*ThrowsLoc=*/SourceLoc(), /*ThrownType=*/TypeLoc(), | |||
params, type, dc); | |||
func->setStatic(isStatic); | |||
func->setAccess(getOverridableAccessLevel(dc)); | |||
func->setAccess(isStatic ? AccessLevel::Public | |||
: getOverridableAccessLevel(dc)); |
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.
Hm, I think accessors match the formal access of their storage declaration, so I don't think you need to explicitly set anything here but make sure that var
gets the expected access level set.
…QUIRES: objc_interop
@swift-ci please test |
…hesizer::createConstant
@swift-ci please test |
@swift-ci please test source compatibility |
swiftlang/swift-source-compat-suite#1000 |
@swift-ci please test Windows platform |
@kubamracek looks like cross-testing doesn't work here but the projects are UPASS'ing so feel free to land once Windows CI is green. |
@swift-ci please test Windows platform |
Right, this actually says the problem is fixed. |
@swift-ci please test Windows platform |
@swift-ci please test Windows platform |
Retrospective: |
This is a fixup for #80749, which has caused a regression in the Source Compatibility test suite. Concretely, the Alamofire and Kommander projects, see https://ci.swift.org/job/swift-main-source-compat-suite-debug/1090/. The failure is a compiler crash when processing OperationQueue.defaultMaxConcurrentOperationCount (which comes from NSOperationQueueDefaultMaxConcurrentOperationCount constant in a header, with an apinote to put it onto NSOperationQueue/OperationQueue). The crash is:
The error message is pretty clear: The accessor cannot be "open" because it's static. This PR fixes the general
createConstant
to avoid creating "open" accessors if they're static.