// RUN: %target-typecheck-verify-swift // rdar://113326835 - Make sure we type-check the conjunctions in source order, // the first closure should be type-checked before we attempt the // TapExpr/SingleValueExpr conjunctions, since they rely on 'k' being resolved. func global(_ x: T) -> String { "" } func global(_ x: Any.Type) -> String { "" } protocol P { associatedtype X } struct Q: P { init() {} func bar(_: String) -> Self { fatalError() } func qux(_: (X) -> U) -> Q { fatalError() } } struct J: P { init(_: X) {} func baz(_ transform: (X) -> T) -> Q { fatalError() } } func foo(a: Int) -> Q { J(a) .baz { x in () return a } .qux { k in Q().bar("\(k)") } } func bar(a: Int) -> Q { J(a) .baz { x in () return a } .qux { k in Q().bar(if .random() { global(k) } else { global(k) }) // expected-error@-1 {{'if' may only be used as expression in return, throw, or as the source of an assignment}} } }