Added tests with SAM adapters in comparison operators.
This commit is contained in:
+2
-1
@@ -57,7 +57,8 @@ import static org.jetbrains.jet.lang.resolve.BindingContext.*;
|
||||
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));
|
||||
TokenSet.create(JetTokens.PLUS, JetTokens.MINUS, JetTokens.MUL, JetTokens.DIV, JetTokens.PERC, JetTokens.RANGE,
|
||||
JetTokens.LT, JetTokens.GT, JetTokens.LTEQ, JetTokens.GTEQ));
|
||||
|
||||
private final Map<String, Integer> anonymousSubclassesCount = new HashMap<String, Integer>();
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
class JavaClass {
|
||||
int compareTo(Runnable i) {
|
||||
i.run();
|
||||
return 239;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
fun box(): String {
|
||||
val obj = JavaClass()
|
||||
|
||||
var v1 = "FAIL"
|
||||
obj < { v1 = "OK" }
|
||||
if (v1 != "OK") return "<: $v1"
|
||||
|
||||
var v2 = "FAIL"
|
||||
obj > { v2 = "OK" }
|
||||
if (v2 != "OK") return ">: $v2"
|
||||
|
||||
var v3 = "FAIL"
|
||||
obj <= { v3 = "OK" }
|
||||
if (v3 != "OK") return "<=: $v3"
|
||||
|
||||
var v4 = "FAIL"
|
||||
obj >= { v4 = "OK" }
|
||||
if (v4 != "OK") return ">=: $v4"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+5
@@ -247,6 +247,11 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege
|
||||
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/operators/binary.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compareTo.kt")
|
||||
public void testCompareTo() throws Exception {
|
||||
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/operators/compareTo.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("contains.kt")
|
||||
public void testContains() throws Exception {
|
||||
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/operators/contains.kt");
|
||||
|
||||
Reference in New Issue
Block a user