| // This source file is part of the Swift.org open source project |
| // |
| // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors |
| // Licensed under Apache License v2.0 with Runtime Library Exception |
| // |
| // See https://swift.org/LICENSE.txt for license information |
| // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors |
| |
| // RUN: %target-swift-frontend %s -emit-ir |
| |
| // Issue found by https://github.com/tenderlove (Aaron Patterson) |
| // https://gist.github.com/tenderlove/66ff6ae1feed92ac37f2 |
| |
| func a(_ x: Any, _ y: Any) -> (((Any, Any) -> Any) -> Any) { |
| return { |
| (m: (Any, Any) -> Any) -> Any in |
| return m(x, y) |
| } |
| } |
| func b(_ z: (((Any, Any) -> Any) -> Any)) -> Any { |
| return z({ |
| (p: Any, q:Any) -> Any in |
| return p |
| }) |
| } |
| b(a(1, a(2, 3))) |