Swift doesn't do type-inference over multiple statements in a closure, so instead it's checking the call to flatMap
in one phase, deducing a type for the closure, and then doing a type-check of the closure body in a second phase.
I have no idea how it settled on (Int) -> String?
as the type for the closure passed to flatMap
, but that's what's happening.