Can't assign array of PartialKeyPaths?

Shouldn't the second assignment work? Instead I get the error.

struct Foo {
    var id: UUID
    var name: String
}

let kp: PartialKeyPath<Foo> = \.name              // Okay.
let kps: [PartialKeyPath<Foo>] = [\.id, \.name]   // Nope.
error: type of expression is ambiguous without more context`
let kps: [PartialKeyPath<Foo>] = [\.id, \.name]
                                 ^~~~~~~~~~~~~~`

Not sure what's going on (perhaps implicit conversion issue), but restating Foo seems to fix it:

let kps: [PartialKeyPath<Foo>] = [\Foo.id, \Foo.name]
Terms of Service

Privacy Policy

Cookie Policy