Xcode 14b3 Ambiguous use of 'split(separator:maxSplits:omittingEmptySubsequences:)'

tl;dr: I don’t know how to fix this so I can build Vapor in Xcode 14b3.

I’m running into an issue with Xcode 14b3:

…/SourcePackages/checkouts/vapor/Sources/Vapor/HTTP/Headers/HTTPHeaders+Directive.swift:230:14: error: ambiguous use of 'split(separator:maxSplits:omittingEmptySubsequences:)'
        self.lazy.split(separator: "\\").reduce(into: "") { (result, part) in
             ^
Swift.Sequence:2:40: note: found this candidate
    @inlinable public __consuming func split(separator: Self.Element, maxSplits: Int = Int.max, omittingEmptySubsequences: Bool = true) -> [ArraySlice<Self.Element>]
                                       ^
Swift.Collection:2:40: note: found this candidate
    @inlinable public __consuming func split(separator: Self.Element, maxSplits: Int = Int.max, omittingEmptySubsequences: Bool = true) -> [Self.SubSequence]

self.lazy is LazySequence<Substring>.

The two calls seem to differ only in their return types, and they belong to Sequence and Collection. Near as I can tell, Substring is a Collection, but I have no idea why the compiler is complaining here.

2 Likes

Try with this:

rm -Rf .build
rm Package.resolved
swift run --configuration debug -Xlinker -rpath -Xlinker "$(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.7/macosx"
2 Likes

I am seeing the same issue for my Vapor project with Xcode 14 GM. I tried the suggested commands but this fixes nothing. Did you manage to sort this out?

I think the commands above fixed it for me.

Thanks. I fixed it with :
update to latest package versions (in Xcode) then on command line:
swift package update
Then did a clean and build
Phew.

2 Likes

Thank you! This worked for me.

tks my friend! ;)