Swift 2.1: Protocol conformance in separate file fails to link property getter
| Originator: | brent | ||
| Number: | rdar://23583600 | Date Originated: | 17-Nov-2015 03:07 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode 7.1.1 (7B1005) |
| Classification: | Feature (New) | Reproducible: | Always |
Summary:
When a struct is declared in file A, and that struct’s conformance to a protocol is declared in file B, and the protocol requires a stored property that’s declared in file A, the files generated by swiftc fail to link.
Steps to Reproduce:
1. Attempt to build the attached sample project, targeting the iPhone Simulator.
Expected Results:
The project builds.
Actual Results:
It does not build; the linker fails with the error:
Undefined symbols for architecture x86_64:
"LinkerBug.Person.identity.getter : Swift.String", referenced from:
protocol witness for LinkerBug.CloudType.identity.getter : Swift.String in conformance LinkerBug.Person : LinkerBug.CloudType in LinkerBug in CloudType.o
Notes:
In the sample project, Person.swift contains the struct and CloudType.swift contains the protocol and extension. All other files are defaults from the Xcode template.
Putting the extension in the same file as the struct’s definition avoids this bug.
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!