-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Protocol conformances in WebKitSwift needlessly use @retroactive #47166
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
Protocol conformances in WebKitSwift needlessly use @retroactive #47166
Conversation
EWS run on previous version of this PR (hash 5ad2b99) |
5ad2b99
to
0319b32
Compare
EWS run on previous version of this PR (hash 0319b32) |
0319b32
to
ff880b1
Compare
EWS run on previous version of this PR (hash ff880b1) |
@@ -23,6 +23,8 @@ | |||
|
|||
#if ENABLE_MEDIA_SESSION_COORDINATOR && HAVE_GROUP_ACTIVITIES | |||
|
|||
@_exported import WebKitSwift |
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.
is this actually needed in every file? _WebKit_SwiftUI does a similar thing, but I only have it in a single dedicated file there
ff880b1
to
9e255a0
Compare
EWS run on current version of this PR (hash 9e255a0) |
https://bugs.webkit.org/show_bug.cgi?id=294955 rdar://154261967 Reviewed by Richard Robinson. WebKitSwift vends Objective-C interfaces declared in headers imported by the WebKitSwift.h umbrella header, but implements these interfaces in Swift using @objc @implementation extensions. In order for the Swift compiler to see the Objective-C declarations, WebKitSwift defines a clang module named WebKitSwift that imports WebKitSwift.h, and Swift files containing the implementations import the WebKitSwift clang module. Since the WebKitSwift Swift module is named libWebKitSwift, technically the Objective-C declarations come from a different module than their implementations. This presents a problem when we attempt to conform these types to a protocol imported from another module. Since the Swift compiler thinks both the interface and the protocol are from imported modules, a "extension declares a conformance of imported type 'Foo' to imported protocol 'Bar'" warning is emitted. Previously we have silenced this warning by annotating the conformance with @retroactive, but it turns out this is unnecessary. Similar to how Swift overlays are implemented in mixed-source frameworks, we can convince Swift that our Objective-C interfaces come from the same module that implements them by giving both the clang and Swift modules the same name (WebKitSwift), and importing the clang module via `@_exported import WebKitSwift`. This allows us to remove the needless @retroactive attributes. * Source/WebKit/Configurations/WebKitSwift.xcconfig: * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Source/WebKit/WebKitSwift/GroupActivities/WKGroupSession.swift: * Source/WebKit/WebKitSwift/LinearMediaKit/LinearMediaPlayer.swift: * Source/WebKit/WebKitSwift/LinearMediaKit/LinearMediaTypes.swift: * Source/WebKit/WebKitSwift/MarketplaceKit/WKMarketplaceKit.swift: * Source/WebKit/WebKitSwift/Preview/WKPreviewWindowController.swift: * Source/WebKit/WebKitSwift/RealityKit/WKRKEntity.swift: * Source/WebKit/WebKitSwift/StageMode/WKStageMode.swift: * Source/WebKit/WebKitSwift/TextAnimation/WKTextAnimationManagerIOS.swift: * Source/WebKit/WebKitSwift/WebKitSwift.swift: Copied from Source/WebKit/WebKitSwift/MarketplaceKit/WKMarketplaceKit.swift. * Source/WebKit/WebKitSwift/WritingTools/IntelligenceTextEffectViewManager.swift: * Source/WebKit/WebKitSwift/WritingTools/PlatformIntelligenceTextEffectView.swift: * Source/WebKit/WebKitSwift/WritingTools/WKIntelligenceReplacementTextEffectCoordinator.swift: * Source/WebKit/WebKitSwift/WritingTools/WKIntelligenceSmartReplyTextEffectCoordinator.swift: Canonical link: https://commits.webkit.org/296629@main
9e255a0
to
55b925e
Compare
Committed 296629@main (55b925e): https://commits.webkit.org/296629@main Reviewed commits have been landed. Closing PR #47166 and removing active labels. |
55b925e
9e255a0
🛠 wpe-cairo