Kitura-net
Kitura-net copied to clipboard
'Error' is ambiguous for type lookup in this context.
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.
@JinHo-C Replacing Error
with Swift.Error
in your code to avoid the conflict with KituraNet.Error
should fix the problem.
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.
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 {
^
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
.