[SR-8791] flatMap -> compactMap deprecation false positive warning #51299
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
type checker
Area → compiler: Semantic analysis
Environment
Swift 4.2
Additional Detail from JIRA
md5: 47c333e90d55c58e5ac502989e8c6bb6
Issue Description:
I have code similar to this in my project:
When compiling the code, I get a warning that flatMap is deprecated and I should switch to compactMap:
But compactMap can only be used if the closure given returns an Optional, in this case I'm returning an Array (which should be flattened). Replacing flatMap with compactMap actually builds fine although the result doesn't get flattened.
The text was updated successfully, but these errors were encountered: