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();
|
||||
}
|
||||
|
||||
void modAssign(Runnable i) {
|
||||
void remAssign(Runnable i) {
|
||||
i.run();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ class JavaClass {
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull JavaClass mod(Runnable i) {
|
||||
@NotNull JavaClass rem(Runnable i) {
|
||||
i.run();
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class JavaClass {
|
||||
return this;
|
||||
}
|
||||
|
||||
JavaClass mod(Runnable i) {
|
||||
JavaClass rem(Runnable i) {
|
||||
i.run();
|
||||
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"
|
||||
}
|
||||
Reference in New Issue
Block a user