swift
swift copied to clipboard
Mimic old objcImpl behavior for early adopters
Before the update to support the new syntax, the decl checker treated private and fileprivate members of objcImpl extensions as non-@objc by default. But SE-0436 specified that private and fileprivate members should be implicitly @objc unless opted out, so when support for the final syntax was added, this behavior was changed retroactively.
Unfortunately, we’ve found that some early adopters depended on the old behavior. Restore some logic deleted by #73309 for early adopter syntax only, with a warning telling the developer to put final
or @nonobjc
on the declaration if they want to preserve the behavior after updating it.
Also tweaks the ObjCImplementationChecker to ensure this logic will actually be run in time for it to suppress the “upgrade to @objc @implementation” warning, and corrects a couple of regressions arising from that change.
Edit: I've added additional commits to correct other issues with this part of the code in #73309:
- Temporarily restores the behavior of an
@objc @_objcImplementation extension
with a warning telling the developer to correct their code - Permanently fixes a regression where a
static
orfinal
member which overrode a superclass method or witnessed a protocol requirement would not be inferred as@objc
.
Fixes rdar://135747897 and rdar://136113393.
Cherry-picking note: This relies on changes in the final version of #76270.