The SE-0249 Proposal gives the following code as an example, but it doesn't compile.
[1, nil, 3, nil, 5].compactMap(\.self)
// error: cannot convert value of type 'WritableKeyPath<Int, Int>' to expected argument type '(Int?) throws -> ElementOfResult?'
Is this a known bug?
1 Like
Jon_Shier
(Jon Shier)
2
Yes, it's a known limitation, but I don't have a bug number offhand. I'll let others fill in the "why".
1 Like
xAlien95
(Stefano De Carolis)
3
SR-12897 is the bug you are looking for.
1 Like
young
(rtSwift)
4
1 Like