You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've attached sample code & a build script to demonstrate the problem. All of the "My*.swift" files are a part of MyModule, which is built as a static library. main.swift is for an executable that will import MyModule.
MyClass conforms to MyProtocol via an extension, which is present in a separate file. Attempting to dynamically cast MyClass to MyProtocol will either fail or crash at runtime, depending on how the cast is performed.
Three ways to workaround this problem:
Move the protocol conformance to the same file as the class definition
Coerce MyClass to MyProtocol first before attempting to dynamically cast to MyProtocol
Build MyModule as a dylib
The text was updated successfully, but these errors were encountered:
Attachment: Download
Environment
Swift 5.0.1, macOS 10.14.4
Swift Development Snapshot toolchain, 2019-04-11
Additional Detail from JIRA
md5: 0cd9932cf7032fccdb1ff06896f91884
duplicates:
Issue Description:
I've attached sample code & a build script to demonstrate the problem. All of the "My*.swift" files are a part of MyModule, which is built as a static library. main.swift is for an executable that will import MyModule.
MyClass conforms to MyProtocol via an extension, which is present in a separate file. Attempting to dynamically cast MyClass to MyProtocol will either fail or crash at runtime, depending on how the cast is performed.
Three ways to workaround this problem:
Move the protocol conformance to the same file as the class definition
Coerce MyClass to MyProtocol first before attempting to dynamically cast to MyProtocol
Build MyModule as a dylib
The text was updated successfully, but these errors were encountered: