// RUN: %target-swift-ide-test -signature-help -code-completion-token=CURRY_TOPLEVEL -source-filename=%s | %FileCheck %s --check-prefix=CURRY_TOPLEVEL // RUN: %target-swift-ide-test -signature-help -code-completion-token=CURRY_MEMBER_PARTIAL -source-filename=%s | %FileCheck %s --check-prefix=CURRY_MEMBER_PARTIAL // RUN: %target-swift-ide-test -signature-help -code-completion-token=CURRY_MEMBER_FULL -source-filename=%s | %FileCheck %s --check-prefix=CURRY_MEMBER_FULL struct Adder { func add(_ x: Int, to y: Int) -> Int { return x + y } func add(oneTo x: inout Int) { x += 1 } func add(_ x: T, to y: T) -> T { return x + y } func add(first: Double!, second: Float, third: Int) -> Double { return first + Double(second) + Double(third) } func add(arg1 param1: Double, arg2: Float, arg3 param3: Int) -> Double { return param1 + Double(arg2) + Double(param3) } func add(numbers: Double...) -> Double { return numbers.reduce(into: 0) { $0 += $1 } } func add(x: Int, y: Int, with adder: (Int, Int) throws -> Int) rethrows -> Int! { return try adder(x, y) } func add(x: Int) -> (Int) -> Int { return { (y: Int) in x + y } } } func topLevelCurried(x: Int) -> (Double) -> (String) -> Void { fatalError() } func testCurryTopLevel() { topLevelCurried(x: 1)(#^CURRY_TOPLEVEL^#) // CURRY_TOPLEVEL: Begin signatures, 1 items // CURRY_TOPLEVEL-DAG: Signature[Active]: (Double) -> (String) -> Void } func testCurryMemberPartial() { Adder.add(#^CURRY_MEMBER_PARTIAL^#) // CURRY_MEMBER_PARTIAL: Begin signatures, 8 items // CURRY_MEMBER_PARTIAL-DAG: Signature[Active]: add(_ self: Adder) -> (Int, Int) -> Int // CURRY_MEMBER_PARTIAL-DAG: Signature: add(_ self: Adder) -> (inout Int) -> () // CURRY_MEMBER_PARTIAL-DAG: Signature: add(_ self: Adder) -> (AdditiveArithmetic, AdditiveArithmetic) -> AdditiveArithmetic // CURRY_MEMBER_PARTIAL-DAG: Signature: add(_ self: Adder) -> (Double?, Float, Int) -> Double // CURRY_MEMBER_PARTIAL-DAG: Signature: add(_ self: Adder) -> (Double, Float, Int) -> Double // CURRY_MEMBER_PARTIAL-DAG: Signature: add(_ self: Adder) -> (Double...) -> Double // CURRY_MEMBER_PARTIAL-DAG: Signature: add(_ self: Adder) -> (Int, Int, (Int, Int) throws -> Int) throws -> Int? // CURRY_MEMBER_PARTIAL-DAG: Signature: add(_ self: Adder) -> (Int) -> (Int) -> Int } func testCurryMemberFull() { let adder = Adder() Adder.add(adder)(#^CURRY_MEMBER_FULL^#) // CURRY_MEMBER_FULL: Begin signatures, 8 items // CURRY_MEMBER_FULL-DAG: Signature[Active]: (_ x: Int, to: Int) -> Int // CURRY_MEMBER_FULL-DAG: Signature: (oneTo: inout Int) // CURRY_MEMBER_FULL-DAG: Signature: (_ x: AdditiveArithmetic, to: AdditiveArithmetic) -> AdditiveArithmetic // CURRY_MEMBER_FULL-DAG: Signature: (first: Double!, second: Float, third: Int) -> Double // CURRY_MEMBER_FULL-DAG: Signature: (arg1: Double, arg2: Float, arg3: Int) -> Double // CURRY_MEMBER_FULL-DAG: Signature: (numbers: Double...) -> Double // CURRY_MEMBER_FULL-DAG: Signature: (x: Int, y: Int, with: (Int, Int) throws -> Int) throws -> Int! // CURRY_MEMBER_FULL-DAG: Signature: (x: Int) -> (Int) -> Int }