diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 2ff0f5bb8d5..b94cfd992c5 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -8,11 +8,11 @@ - + + - - - + + @@ -57,19 +57,6 @@ - + @@ -135,10 +122,28 @@ - + - + + + + + + + + + + + + + + + + + + + @@ -148,37 +153,28 @@ - - - - - - - - - - + - - + + - + - - + + - + @@ -223,16 +219,25 @@ - + - + + + + + + + + + + - + @@ -259,22 +264,22 @@ @@ -661,70 +666,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -787,6 +728,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + localhost @@ -1005,7 +1004,7 @@ @@ -1052,37 +1051,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1090,11 +1058,6 @@ - - - - - @@ -1133,23 +1096,65 @@ - + - + + + + + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/translator/test/org/jetbrains/k2js/test/OperatorOverloadingTest.java b/translator/test/org/jetbrains/k2js/test/OperatorOverloadingTest.java index 42f663d3f15..57d7a98b646 100644 --- a/translator/test/org/jetbrains/k2js/test/OperatorOverloadingTest.java +++ b/translator/test/org/jetbrains/k2js/test/OperatorOverloadingTest.java @@ -73,4 +73,22 @@ public class OperatorOverloadingTest extends TranslationTest { public void plusAssignReassign() throws Exception { testFooBoxIsTrue("plusAssignReassign.kt"); } + + @Test + public void notOverload() throws Exception { + testFooBoxIsTrue("notOverload.kt"); + } + + //TODO: test fails due to issue KT-618 +// @Test +// public void compareTo() throws Exception { +// testFooBoxIsTrue("compareTo.kt"); +// } + + @Test + public void plusAndMinusAsAnExpression() throws Exception { + testFooBoxIsTrue("plusAndMinusAsAnExpression.kt"); + } + + } diff --git a/translator/testFiles/operatorOverloading/cases/compareTo.kt b/translator/testFiles/operatorOverloading/cases/compareTo.kt index e69de29bb2d..816054e2846 100644 --- a/translator/testFiles/operatorOverloading/cases/compareTo.kt +++ b/translator/testFiles/operatorOverloading/cases/compareTo.kt @@ -0,0 +1,17 @@ +namespace foo + + + class A(t : Int) : Comparable { + var i = t + override fun compareTo(other : A) = (this.i - other.i) + } + +fun box() : Boolean{ + return (A(3) > A(2)) && (A(2) >= A(2)) && (A(1) >= A(0)) && (A(2) <= A(2)) && (A(3) <= A(4)) && (A(0) < A(100)) +} + + + +fun main(args : Array) { + System.out?.println(box()) +} \ No newline at end of file diff --git a/translator/testFiles/operatorOverloading/cases/notOverload.kt b/translator/testFiles/operatorOverloading/cases/notOverload.kt new file mode 100644 index 00000000000..cea7ddb2dbb --- /dev/null +++ b/translator/testFiles/operatorOverloading/cases/notOverload.kt @@ -0,0 +1,9 @@ +namespace foo + +class A() { + + fun not() = "hooray" + +} + +fun box() = (!A() == "hooray") \ No newline at end of file diff --git a/translator/testFiles/operatorOverloading/cases/plusAndMinusAsAnExpression.kt b/translator/testFiles/operatorOverloading/cases/plusAndMinusAsAnExpression.kt new file mode 100644 index 00000000000..29b1e79f9c8 --- /dev/null +++ b/translator/testFiles/operatorOverloading/cases/plusAndMinusAsAnExpression.kt @@ -0,0 +1,13 @@ +namespace foo + +class A() { + + fun plus() = "hooray" + fun minus() = "not really" + +} + +fun box() : Boolean { + var c = A() + return (+c + -c == "hooraynot really") +} \ No newline at end of file