Open j-f1 opened 1 year ago
let baz = Wrapper(keyPath: \Model.member) // specify the type of keyPath as KeyPath<Model, String>
Slightly simpler:
struct Model {
let member: String
}
func foo(_: KeyPath<Model, Int32>) {}
func foo(_: KeyPath<Model, Float>) {}
@resultBuilder
struct MyResultBuilder {
static func buildBlock() -> Void {}
}
foo(\.member)
@MyResultBuilder
var built: Void {
foo(\.member)
}
@amritpan is going to look into this one. Note that if we fix standalone foo(\.member)
the result builder case would be fixed as well.
Description When you have (1) a key path to a value of type A, passed to (2) a struct initializer with two overloads which expect the key path to be either of type B or C, (3) inside of a result builder, Swift reports “failed to produce diagnostic for expression; please submit a bug report” instead of a useful error.
Steps to reproduce
Expected behavior
Environment