Supported SAM adapter in infix calls.

This commit is contained in:
Evgeny Gerashchenko
2013-06-26 01:26:46 +04:00
parent 79185b6775
commit 939b658704
4 changed files with 19 additions and 1 deletions
@@ -58,7 +58,8 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
private static final TokenSet BINARY_OPERATIONS =
TokenSet.orSet(JetTokens.AUGMENTED_ASSIGNMENTS,
TokenSet.create(JetTokens.PLUS, JetTokens.MINUS, JetTokens.MUL, JetTokens.DIV, JetTokens.PERC, JetTokens.RANGE,
JetTokens.LT, JetTokens.GT, JetTokens.LTEQ, JetTokens.GTEQ));
JetTokens.LT, JetTokens.GT, JetTokens.LTEQ, JetTokens.GTEQ,
JetTokens.IDENTIFIER));
private final Map<String, Integer> anonymousSubclassesCount = new HashMap<String, Integer>();
@@ -0,0 +1,5 @@
class JavaClass {
void doSomething(Runnable i) {
i.run();
}
}
@@ -0,0 +1,7 @@
fun box(): String {
val obj = JavaClass()
var v = "FAIL"
obj doSomething { v = "OK" }
return v
}
@@ -262,6 +262,11 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/operators/get.kt");
}
@TestMetadata("infixCall.kt")
public void testInfixCall() throws Exception {
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/operators/infixCall.kt");
}
@TestMetadata("invoke.kt")
public void testInvoke() throws Exception {
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/operators/invoke.kt");