Avatar
Author icon
kishikawakatsumi
let rows = [10, 20] let results1 = rows.flatMap { row in var entries = [Int]() entries.append(row) return entries }
Version:
swift-DEVELOPMENT-SNAPSHOT-2019-10-13-a
Output:
Error:
/usercode/main.swift:5:12: error: cannot convert return expression of type '[Int]' to return type 'String?' return entries ^~~~~~~ /usercode/main.swift:2:21: error: 'flatMap' has been renamed to 'compactMap(_:)': Please use compactMap(_:) for the case where closure returns an optional value let results1 = rows.flatMap { row in ^~~~~~~ compactMap Swift.Collection:3:17: note: 'flatMap' was obsoleted in Swift 5.0 public func flatMap(_ transform: (Self.Element) throws -> String?) rethrows -> [String] ^