Kitura / CloudEnvironment

Convenience Swift package for accessing environment variables, credentials.
Apache License 2.0
12 stars 16 forks source link

CloudEnvironment.Credentials is incompatible with Kitura-Credentials (or the other way around) #47

Closed krzyzanowskim closed 4 years ago

krzyzanowskim commented 6 years ago

If both modules CoudEnvirnment and Kitura-Credentials (Credentials) is imported, the type Credentials is ambiguous for the compiler. It looks like it's a compiler limitation https://bugs.swift.org/browse/SR-6705 so It may be a good idea to address the issue on the source level. Since CloudEnvironment is often used with the Kitura framework, it may be a good idea to clarify the Credentials type.

Kitura-Credentials report: https://github.com/IBM-Swift/Kitura-Credentials/issues/36

import CloudEnvironment
import Credentials

public class App {
    let credentials: Credentials.Credentials
}
Application.swift:18:22: error: 'Credentials' is ambiguous for type lookup in this context
    var credentials: Credentials.Credentials
                     ^~~~~~~~~~~
CloudEnvironment.Credentials:4:14: note: found this candidate
public class Credentials {
             ^
Credentials.Credentials:2:14: note: found this candidate
public class Credentials : RouterMiddleware {
             ^
EnriqueL8 commented 6 years ago

Hey @krzyzanowskim, an idea to solve this is to define a typealias for example

typealias CloudEnvironmentCredentials = CloudEnvironment.Credentials