Skip to content
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

'Error' is ambiguous for type lookup in this context. #182

Open
JinHo-C opened this issue Mar 27, 2017 · 4 comments
Open

'Error' is ambiguous for type lookup in this context. #182

JinHo-C opened this issue Mar 27, 2017 · 4 comments

Comments

@JinHo-C
Copy link

JinHo-C commented Mar 27, 2017

Hello,

When I import Kitura-net (KituraNet), I get errors like below.

'Error' is ambiguous for type lookup in this context.

KituraNet causes this error because it has a "public" enum named Error on Error.swift.

As you know, Swift 3 uses Error instead of NSError now.

So, I think it should be fixed.

@na-gupta
Copy link
Contributor

@JinHo-C Replacing Error with Swift.Error in your code to avoid the conflict with KituraNet.Error should fix the problem.

@youming-lin
Copy link
Collaborator

We should slate a name change for the next major version release. If another library is extending from Error without specifying Swift.Error, and the application imports both that library and Kitura-net, then this issue will still come up.

@na-gupta
Copy link
Contributor

I agree it's probably a better design decision to name things so they don't conflict with the standard library.

However, if another library defines an enum or class called Error that adopts Error without specifying Swift.Error, that should cause a compile error:

error: circular enum raw types Error
public enum Error: Error {
            ^
error: circular class inheritance Error
public class Error: Error {
             ^

@youming-lin
Copy link
Collaborator

I was thinking of a namespace issue, but I guess in my example it's not an issue due to the third party library not having a dependency on Kitura-net.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants