Extract usages of legacy 'mod' in a separate test
This commit is contained in:
committed by
Ilya Gorbunov
parent
053b54d216
commit
f23528770b
+1
-1
@@ -18,7 +18,7 @@ class JavaClass {
|
|||||||
i.run();
|
i.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
void modAssign(Runnable i) {
|
void remAssign(Runnable i) {
|
||||||
i.run();
|
i.run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ class JavaClass {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull JavaClass mod(Runnable i) {
|
@NotNull JavaClass rem(Runnable i) {
|
||||||
i.run();
|
i.run();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class JavaClass {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
JavaClass mod(Runnable i) {
|
JavaClass rem(Runnable i) {
|
||||||
i.run();
|
i.run();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
+45
@@ -0,0 +1,45 @@
|
|||||||
|
// !LANGUAGE: -ProhibitOperatorMod
|
||||||
|
// FILE: Java.java
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
class AugmentedAssignmentPure {
|
||||||
|
void modAssign(Runnable i) {
|
||||||
|
i.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class AugmentedAssignmentViaSimpleBinary {
|
||||||
|
@NotNull AugmentedAssignmentViaSimpleBinary rem(Runnable i) {
|
||||||
|
i.run();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Binary {
|
||||||
|
Binary rem(Runnable i) {
|
||||||
|
i.run();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: 1.kt
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val augAssignmentPure = AugmentedAssignmentPure()
|
||||||
|
var v1 = "FAIL"
|
||||||
|
augAssignmentPure %= { v1 = "OK" }
|
||||||
|
if (v1 != "OK") return "assignment pure: $v1"
|
||||||
|
|
||||||
|
var augmentedAssignmentViaSimpleBinary = AugmentedAssignmentViaSimpleBinary()
|
||||||
|
var v2 = "FAIL"
|
||||||
|
augmentedAssignmentViaSimpleBinary %= { v2 = "OK" }
|
||||||
|
if (v2 != "OK") return "assignment via simple binary: $v2"
|
||||||
|
|
||||||
|
val binary = Binary()
|
||||||
|
var v3 = "FAIL"
|
||||||
|
binary % { v3 = "OK" }
|
||||||
|
if (v3 != "OK") return "binary: $v3"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+5
@@ -847,6 +847,11 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxAga
|
|||||||
runTest("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/invoke.kt");
|
runTest("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/invoke.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("legacyModOperator.kt")
|
||||||
|
public void testLegacyModOperator() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/legacyModOperator.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("multiGetSet.kt")
|
@TestMetadata("multiGetSet.kt")
|
||||||
public void testMultiGetSet() throws Exception {
|
public void testMultiGetSet() throws Exception {
|
||||||
runTest("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/multiGetSet.kt");
|
runTest("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/multiGetSet.kt");
|
||||||
|
|||||||
Generated
+5
@@ -847,6 +847,11 @@ public class IrBlackBoxAgainstJavaCodegenTestGenerated extends AbstractIrBlackBo
|
|||||||
runTest("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/invoke.kt");
|
runTest("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/invoke.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("legacyModOperator.kt")
|
||||||
|
public void testLegacyModOperator() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/legacyModOperator.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("multiGetSet.kt")
|
@TestMetadata("multiGetSet.kt")
|
||||||
public void testMultiGetSet() throws Exception {
|
public void testMultiGetSet() throws Exception {
|
||||||
runTest("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/multiGetSet.kt");
|
runTest("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/multiGetSet.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user