[swift-users] Class extension issues (Xcode 7.3 (7D175))

Jordan Rose jordan_rose at apple.com
Wed Jun 8 13:17:01 CDT 2016


Hey, Victor. This is a longstanding issue that has to do with us resolving extensions very early in compilation; there are a handful of reports on JIRA and Radar but no one's really had the chance to look into it. The issues should be inconsistent but deterministic, i.e. it would only affect some files and not others, but it won't change from affecting one file to not affecting it if there are no changes in the code.

The safest workaround is to define your types at the top-level and use typealiases to make them nested, and have the extensions refer to the top-level type.

Sorry for the inconvenience,
Jordan


> On Jun 7, 2016, at 16:48, Victor Leong via swift-users <swift-users at swift.org> wrote:
> 
> Hey guys, 
> 
> I'm starting to see problems related struct namespacing with extensions. For example:
> 
> I have the following definition in file: "aaa.swift":
> public struct aaa {
>    public struct bbb {
>       public struct ccc{
>       ...
>       }
>    }
> }
> 
> I have a second find: "bbb.swift" that tries to use:
> aaa.bbb.ccc but it would say ccc is not a member of aaa.bbb.
> 
> If I move the code to file "aaa.swift" then the compile would work.
> 
> What I noticed is that this isn't deterministic either, it would happen for only a few namespaces in certain files.
> 
> Am I doing something wrong?
> 
> Thanks,
> Victor Leong | Software Developer
> victor.leong at visiercorp.com <mailto:victor.leong at visiercorp.com>
> 
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160608/341d63e8/attachment.html>


More information about the swift-users mailing list