Possible compiler bug in Swift 5.7, compactMap disambiguation? #254
lukeredpath
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've run into an issue in my project where the Swift compiler seems to be favouring the
Parser.compactMap
method on a[String]
over the foundationcompactMap
in some scenarios, particularly if there is some other compiler error within the compact map closure. I've managed to reproduce this with some examples in the Parsing playground here which should hopefully demonstrate the problem.https://github.com/lukeredpath/swift-parsing/blob/lukeredpath/swift-parser-bug/Parsing.playground/Contents.swift
It's as if the
@disfavoredOverload
annotation is not being respected, but I can't see why the compiler is even getting confused given I'm being explicit about the return type, andParser.compactMap
returns aParsers.CompactMap
type, not a[Value]
.Has anyone run into something similar? This feels like a compiler bug.
Beta Was this translation helpful? Give feedback.
All reactions