Files
swift-mirror/test/Interpreter/currying_protocols.swift
Ted Kremenek fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00

24 lines
374 B
Swift

// RUN: %target-run-simple-swift | FileCheck %s
protocol P {
func scale(x : Int)(y : Int) -> Int
}
struct S : P {
var offset : Int
func scale(x : Int)(y : Int) -> Int {
return offset + x * y
}
}
func foo<T : P>(t : T) {
print("\(t.scale(7)(y: 13))\n")
}
foo(S(offset: 4))
// CHECK: 95
let p : P = S(offset: 4)
print("\(p.scale(5)(y: 7))\n")
// CHECK: 39