-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Sema] Only require a default implementation for SPI requirements in non-SPI protocols #32793
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 |
878cc32
to
4f55a02
Compare
@swift-ci Please smoke test |
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.
This change looks good. However, is there a runtime test verifying that test cases like PublicProto
work correctly?
lib/Sema/TypeCheckAttr.cpp
Outdated
extension->isConstrainedExtension()) | ||
return false; | ||
if (!protocol->isSPI()) { | ||
auto implementations = TypeChecker::lookupMember( |
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.
This should reuse the existing logic for finding default implementations instead of rolling its own.
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.
More specifically I think these checks could be moved to typechecker::inferDefaultWitnesses().
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.
Thank you for pointing this out. I moved the check and it is much cleaner!
Asides from removing duplicated code this change also now checks implicit SPI requirements and applies only in library evolution mode.
…ntation The check for SPI protocol requirements needing a default implementation should ignore requirements in a protocol that is SPI too. The protocol can’t be conformed to without knowing of the requirement. rdar://65286171
4f55a02
to
d70b0c9
Compare
Moved the check to TypeCheckProtocol with pre-existing logic. I'll have to spend more time on the runtime test. It works as expected with library evolution but it crashes in an ugly way without it when rebuilding from the public swiftinterface. @swift-ci Please smoke test |
The check for SPI protocol requirements needing a default implementation should ignore requirements in a protocol that is SPI too. The protocol can’t be conformed to without knowing of the requirement.
rdar://65286171