error: ambiguous use of operator

I've got a package that I'm working on that is running into a weird
error. When I run `swift build` it is failing with:

/private/tmp/langserver-swift/Sources/JSONRPC/Types/Request.swift:54:46:
error: ambiguous use of operator '<|'
        let dMethod: Decoded<String> = (json <| "method")
                                             ^
Argo.<|:14:13: note: found this candidate
public func <|<A : Decodable where A == A.DecodedType>(json: Argo.JSON,
key: String) -> Argo.Decoded<A>
            ^
Argo.<|:14:13: note: found this candidate
public func <|<A : Decodable where A == A.DecodedType>(json: Argo.JSON,
key: String) -> Argo.Decoded<A>

The problem is that when I tell SwiftPM to build an Xcode project for me
and build in Xcode then it compiles just fine. You can experience this
behavior for yourself in this repository:

Is this a bug in my Package.swift or with SwiftPM?

Would you mind reducing this to a minimal package which can reproduce this
issue?

···

On Sat, Nov 26, 2016 at 3:46 AM, Ryan Lovelett via swift-build-dev < swift-build-dev@swift.org> wrote:

I've got a package that I'm working on that is running into a weird
error. When I run `swift build` it is failing with:

/private/tmp/langserver-swift/Sources/JSONRPC/Types/Request.swift:54:46:
error: ambiguous use of operator '<|'
        let dMethod: Decoded<String> = (json <| "method")
                                             ^
Argo.<|:14:13: note: found this candidate
public func <|<A : Decodable where A == A.DecodedType>(json: Argo.JSON,
key: String) -> Argo.Decoded<A>
            ^
Argo.<|:14:13: note: found this candidate
public func <|<A : Decodable where A == A.DecodedType>(json: Argo.JSON,
key: String) -> Argo.Decoded<A>

The problem is that when I tell SwiftPM to build an Xcode project for me
and build in Xcode then it compiles just fine. You can experience this
behavior for yourself in this repository:
GitHub - RLovelett/langserver-swift: A Swift implementation of the open Language Server Protocol.

Is this a bug in my Package.swift or with SwiftPM?
_______________________________________________
swift-build-dev mailing list
swift-build-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-build-dev

--
Ankit

Sure thing! I actually found someone who was running into a variation on
the same theme. So I'll actually just include their minimal code.

The attached example.tar.xz file contains all the source in the above
example. It exhibits the same behavior. If you run `swift build` it
fails. If you run `swift package generate-xcodeproj` and build in Xcode
it compiles just fine.

example.tar.xz (648 Bytes)

···

On Mon, Nov 28, 2016, at 04:59 AM, Ankit Agarwal wrote:

Would you mind reducing this to a minimal package which can reproduce
this issue?

On Sat, Nov 26, 2016 at 3:46 AM, Ryan Lovelett via swift-build-dev <swift-build- > dev@swift.org> wrote:

I've got a package that I'm working on that is running into a weird

error. When I run `swift build` it is failing with:

/private/tmp/langserver-
swift/Sources/JSONRPC/Types/Request.swift:54:46:
error: ambiguous use of operator '<|'

     let dMethod: Decoded<String> = (json <| "method")
                                          ^

Argo.<|:14:13: note: found this candidate

public func <|<A : Decodable where A == A.DecodedType>(json:
Argo.JSON,
key: String) -> Argo.Decoded

         ^

Argo.<|:14:13: note: found this candidate

public func <|<A : Decodable where A == A.DecodedType>(json:
Argo.JSON,
key: String) -> Argo.Decoded

The problem is that when I tell SwiftPM to build an Xcode project
for me
and build in Xcode then it compiles just fine. You can
experience this
behavior for yourself in this repository:

GitHub - RLovelett/langserver-swift: A Swift implementation of the open Language Server Protocol.

Is this a bug in my Package.swift or with SwiftPM?

_______________________________________________

swift-build-dev mailing list

swift-build-dev@swift.org

https://lists.swift.org/mailman/listinfo/swift-build-dev

--

Ankit

Maintainer of Argo here, I finally had time to look at this on my end today.

This appears to be a bug around duplicate filenames that aren't caught when
building the lib via `swift build` because of case differences. In our case,
we had two files named `decode.swift` with different cases in different
sub-directories:

❯ g ls-files | grep -i decode.swift
Sources/Argo/Functions/decode.swift
Sources/Argo/Operators/Decode.swift

This meant that `swift build` succeeded for us (and for our users), but then
when the consuming code was compiled, it (seemingly) found duplicates of one
of the files in the built binary.

I assume the simplest fix here would be to make sure that we're doing a
case-insensitive compare when checking filenames. However, as a package
maintainer I will say that I find this behavior a _bit_ annoying in general.
I'd _much_ rather see the ability to name files whatever makes the most sense
without needing to ensure that the filenames are unique in the package.

I've uploaded a small lib that exhibits this bug to my GitHub:

- gordon