Cannot Reference Nested Types Declared in Extensions

Originator:wirth_caesar
Number:rdar://24498168 Date Originated:04-Feb-2016
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 7.2.1 (7C1002)
Classification:Other Bug Reproducible:Always
 
Summary:
Xcode will fail to build a project if you reference a nested type that was declared in an extension, if the file that is doing the referencing comes earlier in the Compile Sources Build Phase than the file in which the nested type is declared in.

Steps to Reproduce:
```
// AFile.swift
extension MyStruct.InnerStruct { }
```

```
// ZFile.swift

struct MyStruct { }

extension MyStruct {
    struct InnerStruct { }
}
```

1. Open Xcode
2. Create a new project
3. Add the 2 files mentioned above
4. Make sure AFile.swift comes above ZFile.swift in the Comile Sources step in the Build Phases
5. Try to compile

Expected Results:
The project to compile

Actual Results:
It errors out on me

Version:
Xcode Version 7.2.1 (7C1002)
OS X Version 10.11.3 (15D21)


Notes:
We use a script[1] to sort our Xcode project to make merges and things easier to handle. As a result, everything is alphabetized. That's not the problem, but it's how we discovered it.

If AFile.swift comes before ZFile.swift in the Compile Sources Build Phase, you will be presented wth an error "'InnerStruct' is not a member type of 'MyStruct'"

Put ZFile.swift above AFile.swift, and everything builds smoothly.

[1] https://github.com/adobe/webkit/blob/master/Tools/Scripts/sort-Xcode-project-file

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!