New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-5304] Same name for class and namespace #47879
Comments
Comment by Marián Černý (JIRA) This issue is not fixed yet. Tested in Swift 4.2 Xcode 10.0. Framework A:
Framework B:
Application:
{{ var magazine: B.Magazine?}} {{}}} This produces an error: 'Magazine' is not a member type of 'B' The problem is that there is a type B named the same name as the framework B. A possible workaround is to create `public typealias B_Magazine = Magazine` inside the framework B and use `B_Magazine` instead of `B.Magazine`. |
Comment by Marián Černý (JIRA) Similar problem. I have a framework Reachability which has a class named Reachability. I want to create my own wrapper class Reachability inside the App and use the Reachability from the framework inside the class. Framework Reachability:
Application:
{{ let reachability = Reachability.Reachability()}} {{}}} Same error message: Type 'Reachability' has no member 'Reachability' Possible workaround is to add `typealias FrameworkReachability = Reachibility` inside the framework (but I don’t want to change the framework) or rename Application’s Reachability for example to MyReachability (which I don’t like, because each module has it’s own namespace and there is no other type Reachability in the app). A possible solution could be allowing renaming the imports, such as:
|
Comment by Artem Loenko (JIRA) This is still the case with Xcode 11.2 (11.2.1 GM). And we have some issues due to the problem. I think this one is quite important due to the fact that we have the module stability now, and a lot of 3rd party libraries started to adopt |
Any progress on that issue ? It is frankly a very weird limitation. it is not uncommon for modules to contain a public class of the same name as the module.. |
+1 same probrom |
Environment
Xcode 8.3.3
Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42)
Additional Detail from JIRA
md5: 2b862ecbd903be9a1fa2942328b1de8e
duplicates:
Issue Description:
I have type
Magazine
declared in two frameworks.So I get
'Magazine' is ambiguous for type lookup in this context
error.When I add the correct prefix
Book.Magazine
, I get'Magazine' is not a member type of 'Book'
, because there is a typeBook
as well.It's not possible to specify the correct namespace, because the compiler is looking for nested class with the same name instead.
Similar issue: https://forums.developer.apple.com/thread/47421
The text was updated successfully, but these errors were encountered: