mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Inheritance of a protocol from JavaScriptCore's JSExport protocol is used to indicate that the methods and properties of that protocol should be exported to JavaScript. The actual check to determine whether a protocol (directly) inherits JSExport is performed via the Objective-C runtime. Note that the presence of JSExport in the protocol hierarchy is not sufficient; the protocol must directly inherit JSExport. Swift warns about redundant conformance requirements and eliminates them from the requirement signature (and, therefore, the Objective-C metadata). This behavior is incorrect for JSExport, because the conformance is actually needed for this API to work properly. Recognize a protocol's inheritance JSExport specifically (by name) when computing the requirement signature of the protocol. When we find such a redundancy, suppress the "redundant conformance constraint" diagnostic and add a new (hidden) attribute @_restatedObjCConformance(proto). The attribute is used only by Objective-C protocol metadata emission to ensure that we get the expected metadata in the Objective-C runtime. Fixes rdar://problem/32674145.
829 B
829 B