Linker error in Xcode 9 in a project with a cross-module Swift subclass of a nested type
| Originator: | arnold.sakhnov | ||
| Number: | rdar://32885384 | Date Originated: | 2017/06/21 |
| Status: | Open | Resolved: | |
| Product: | Xcode 9 | Product Version: | Version 9.0 beta (9M136h) |
| Classification: | Bug | Reproducible: | Always |
Summary: Xcode 9 beta 1 is unable to build a workspace, where the app module's Swift code contains a subclass of an open class from a dependency module. The linker error only occurs if the said base open class is: 1. a nested type (e.g. is defined inside an empty struct), AND 2. contains a `private(set) public var` property Xcode 8.x is able to build a workspace with such as setup fine and doesn't produce linker errors. Steps to Reproduce: 1. Create an Xcode workspace with two Swift modules: an app and a framework dependency. 2. In the framework module, create a *nested* open class with a `private(set) public var` property. 3. In the app module, import the framework and create a subclass of the said base class and attempt to use it. 4. Build the workspace. See attached sample project. Expected Results: The workspace builds and the app runs. Observed Results: The workspace fails to build with a linker error. Version: Xcode 9 beta 1 (9M136h), iOS 11 beta 1 SDK, running on macOS Sierra 10.12.5 (16F73). Notes: Workarounds that can be implemented to get such a workspace to build in Xcode 9 are: * Un-nesting the base class (turning into a top level open class in the framework module), OR * Changing the base class's `private(set)` property access level to `public`, OR * Not subclassing the base class in the app module and simply using the base class directly all "resolve" the linker error.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!