mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
When simplifying a keypath constraint with a function type binding, single-parameter functions have the parameter type and the return type matched against the keypath root and value; whereas multiple-parameter functions cause an ambiguous failure (in `simplifyKeyPathConstraint`). Resolves rdar://problem/57930643
11 lines
397 B
Swift
11 lines
397 B
Swift
// RUN: %target-swift-frontend -typecheck -verify -primary-file %s
|
|
|
|
// rdar://problem/57930643
|
|
struct School {
|
|
var name: String
|
|
}
|
|
func testKeyPathClosureLiteralError() -> [School] {
|
|
let slist = [School(name:"AHS"), School(name:"BHS")]
|
|
return slist.sorted(by: \School.name) // expected-error {{cannot convert key path into a multi-argument function type '(School, School) throws -> Bool'}}
|
|
}
|