From f58d0193ebcb37702a28a728c575da6e3f4b7b83 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Wed, 23 May 2012 12:50:05 +0400 Subject: [PATCH] test for KT-1878 Support 'invoke' functions short way invocation --- compiler/testData/codegen/functions/invoke.kt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/compiler/testData/codegen/functions/invoke.kt b/compiler/testData/codegen/functions/invoke.kt index 4f85a25ef06..9fed2555868 100644 --- a/compiler/testData/codegen/functions/invoke.kt +++ b/compiler/testData/codegen/functions/invoke.kt @@ -10,13 +10,19 @@ class Method { fun test3(method: Method, i: Int) = method.invoke(i) -//todo -//fun test4(method: Method, i: Int) = method(i) +fun test4(method: Method, i: Int) = method(i) + +class Method2 {} + +fun Method2.invoke(s: String) = s + +fun test5(method2: Method2, s: String) = method2(s) fun box() : String { if (test1({ it }, 1) != 1) return "fail 1" if (test2({ it }, 2) != 2) return "fail 2" if (test3(Method(), 3) != 3) return "fail 3" - //if (test4(Method(), 4) != 4) return "fail 4" + if (test4(Method(), 4) != 4) return "fail 4" + if (test5(Method2(), "s") != "s") return "fail5" return "OK" -} +} \ No newline at end of file