<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thanks a lot, Jordan; your suspicion is correct! That appears to be the issue I'm having--although unlike what's captured in the JIRA ticket, in my case there are no generics involved.<div class=""><div class=""><div class=""><br class=""></div><div class="">Would you mind if I updated this ticket with the additional info related to the scenario I hit?<br class=""><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 8, 2016, at 5:41 PM, Jordan Rose <<a href="mailto:jordan_rose@apple.com" class="">jordan_rose@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi, Evan. Just a suspicion: do you also have a <i class="">type</i> named AppleTart? In that case you'd be hitting <a href="https://bugs.swift.org/browse/SR-898" class="">SR-898</a>, rather than a specific issue with extensions.</div><div class=""><br class=""></div><div class="">Jordan</div><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Mar 8, 2016, at 14:26, Evan Maloney via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">I recently ran into a situation where I needed to import a symbol with the same name from two different modules, and noticed that the usual Swift technique of disambiguating using the package name doesn't work when used with extensions.<br class=""><br class="">In my case, I have a package 'LegacyStore' and a package 'AppleTart', both of which contain a type named 'User'.<br class=""><br class="">In the case of LegacyStore, User is an Objective-C class, and in the case of AppleTart, User is a Swift struct.<br class=""><br class="">Normally, I'd be able to refer to one as 'LegacyStore.User' and the other as 'AppleTart.User', but when using this notation for an extension:<br class=""><br class=""> extension AppleTart.User<br class=""> {<br class=""> public var legacyUser: LegacyStore.User {<br class=""> // implementation<br class=""> }<br class=""> }<br class=""><br class="">...I get a compiler error on the extension declaration line:<br class=""><br class=""> error: 'User' is not a member type of 'AppleTart'<br class=""><br class="">Note that the 'LegacyStore.User' notation used in the var declaration never triggers a compiler error, so I'm assuming the notation just isn't supported yet in the context of declaring an extension.<br class=""><br class="">Fortunately, there's a (somewhat cumbersome) work-around, which is to create two separate files, one for each module. Within each file import just that one module, and create a typealias for each clashing name using package-qualified name of the type.<br class=""><br class="">For example, here's the relevant part of my AppleTartTypeDisambiguation.swift file:<br class=""><br class=""> import AppleTart<br class=""><br class=""> public typealias AppleTartUser = User<br class=""><br class="">And here's my LegacyStoreTypeDisambiguation.swift file:<br class=""><br class=""> import LegacyStore<br class=""><br class=""> public typealias LegacyUser = User<br class=""><br class="">I can then use the typealiases to extend either type. For example, here's how I successfully extended AppleTart.User:<br class=""><br class=""> extension AppleTartUser<br class=""> {<br class=""> public var legacyUser: LegacyStore.User {<br class=""> // implementation<br class=""> }<br class=""> }<br class=""><br class="">Should the inability to extend a type using the qualified type name be considered a compiler bug? I'm assuming yes. If so, I'll file a ticket.<br class=""><br class="">_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-users" class="">https://lists.swift.org/mailman/listinfo/swift-users</a><br class=""></div></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div></div></div></body></html>