Files
swift-mirror/test/Interpreter/currying_protocols.swift
John McCall dce0931793 Remove an over-aggressive assert. Curried methods work in
protocols; we treat the method's natural uncurrying level as
the specified level.

Swift SVN r14053
2014-02-18 22:16:53 +00:00

24 lines
352 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)(13))\n")
}
foo(S(4))
// CHECK: 95
val p : P = S(4)
print("\(p.scale(5)(7))\n")
// CHECK: 39