mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
If a type variable doesn't have any "direct" bindings let's not consider it as viable to be attempted next. Such type variables are helps purely to accommodate transitive binding inference for other members of subtype chain. Resolves: rdar://problem/66234725
29 lines
553 B
Swift
29 lines
553 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
protocol P {}
|
|
|
|
protocol Func {
|
|
associatedtype Result
|
|
|
|
init()
|
|
|
|
mutating func update<D: P>(data: D)
|
|
|
|
func finalize() -> Result
|
|
}
|
|
|
|
struct S<T: P, F: Func> {
|
|
var arr: [T]
|
|
|
|
func test() -> [F.Result] {
|
|
return stride(from: 0, to: arr.endIndex, by: 2).map {
|
|
(arr[$0], $0 < arr.index(before: arr.endIndex) ? arr[$0.advanced(by: 1)] : nil) // Ok
|
|
}.map { (lhs, rhs) -> F.Result in
|
|
var fun = F()
|
|
fun.update(data: lhs)
|
|
fun.update(data: rhs!)
|
|
return fun.finalize()
|
|
}
|
|
}
|
|
}
|