From 5eaa5b396bbd66d9bba61638ba1221a9b1525ab8 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Tue, 18 Sep 2012 13:48:20 +0400 Subject: [PATCH] Removing usages of tuples from test data (KT-2358 Drop tuples) #KT-2358 In progress --- .../dataClasses/tostring/unitComponent.kt | 4 +- .../codegen/dataClasses/unitComponent.kt | 2 +- .../codegen/functions/defaultargs2.jet | 19 +++++++- .../testData/codegen/regressions/kt1538.kt | 10 ++--- .../testData/codegen/regressions/kt2062.kt | 2 +- .../testData/codegen/regressions/kt237.jet | 6 +-- .../testData/codegen/regressions/kt344.jet | 18 ++++---- compiler/testData/codegen/tuples/basic.jet | 6 --- compiler/testData/diagnostics/tests/Bounds.kt | 4 +- compiler/testData/diagnostics/tests/Casts.kt | 2 +- .../diagnostics/tests/FunctionReturnTypes.kt | 6 +-- .../diagnostics/tests/LValueAssignment.kt | 5 ++- .../testData/diagnostics/tests/Nullability.kt | 16 +++---- compiler/testData/diagnostics/tests/Super.kt | 2 +- .../testData/diagnostics/tests/Unresolved.kt | 6 ++- compiler/testData/diagnostics/tests/When.kt | 4 +- .../tests/controlStructures/kt657.kt | 4 +- .../controlStructures/when.kt234.kt973.kt | 9 ++-- .../tests/dataFlow/TupleExpression.kt | 7 --- .../tests/extensions/ExtensionFunctions.kt | 2 +- .../diagnostics/tests/infos/Autocasts.kt | 27 ++--------- .../diagnostics/tests/j+k/OverrideVararg.kt | 2 +- .../tests/nullabilityAndAutoCasts/kt2234.kt | 6 ++- .../override/EqualityOfIntersectionTypes.kt | 4 +- .../diagnostics/tests/override/NonGenerics.kt | 16 +++---- .../diagnostics/tests/regressions/kt353.kt | 2 +- .../diagnostics/tests/subtyping/kt-1457.kt | 6 ++- .../diagnostics/tests/tuples/BasicTuples.kt | 4 -- .../loadJava/MethodTypePOneUpperBound.kt | 2 +- compiler/testData/loadJava/MethodWithTypeP.kt | 2 +- .../testData/loadJava/MethodWithTypePP.kt | 2 +- .../loadJava/MethodWithTypePRefClassP.kt | 2 +- .../testData/loadJava/MethosWithPRefTP.kt | 2 +- .../testData/loadJava/vararg/VarargInt.kt | 2 +- .../testData/loadJava/vararg/VarargString.kt | 2 +- .../FunParamTwoUpperBounds.kt | 2 +- compiler/testData/loadKotlin/type/Tuple0.kt | 2 +- compiler/testData/renderer/TupleTypes.kt | 12 ----- .../checkers/JetDiagnosticsTestGenerated.java | 10 ----- .../jetbrains/jet/codegen/ClassGenTest.java | 2 +- .../jet/codegen/NamespaceGenTest.java | 22 --------- .../jetbrains/jet/codegen/TupleGenTest.java | 5 --- idea/testData/checker/Bounds.jet | 4 +- idea/testData/checker/Casts.jet | 2 +- idea/testData/checker/ExtensionFunctions.jet | 2 +- idea/testData/checker/FunctionReturnTypes.jet | 6 +-- idea/testData/checker/Nullability.jet | 16 +++---- idea/testData/checker/Unresolved.jet | 6 ++- idea/testData/checker/When.jet | 4 +- idea/testData/checker/infos/Autocasts.jet | 27 ++--------- .../intentions/specifyType/afterUnitType.kt | 2 +- .../intentions/specifyType/beforeUnitType.kt | 2 +- .../libraries/decompiled/namespace.kt | 6 +-- idea/testData/libraries/library/main.kt | 8 ++-- .../libraries/usercode/ExtensionProperty.kt | 5 ++- .../libraries/usercode/GlobalProperty.kt | 2 +- idea/testData/resolve/std/unit.kt | 2 +- .../k2js/test/semantics/TupleTest.java | 45 ------------------- .../additional/cases/defaultargs2.jet | 19 +++++++- .../testFiles/tuple/cases/multipleMembers.kt | 15 ------- .../testFiles/tuple/cases/tuplesEquals.kt | 31 ------------- .../testFiles/tuple/cases/twoElements.kt | 6 --- .../webDemoCanvasExamples/cases/Creatures.kt | 20 ++++----- .../doc/highlighter2/Html2CompilerPlugin.kt | 2 +- 64 files changed, 172 insertions(+), 330 deletions(-) delete mode 100644 compiler/testData/codegen/tuples/basic.jet delete mode 100644 compiler/testData/diagnostics/tests/dataFlow/TupleExpression.kt delete mode 100644 compiler/testData/diagnostics/tests/tuples/BasicTuples.kt delete mode 100644 js/js.tests/test/org/jetbrains/k2js/test/semantics/TupleTest.java delete mode 100644 js/js.translator/testFiles/tuple/cases/multipleMembers.kt delete mode 100644 js/js.translator/testFiles/tuple/cases/tuplesEquals.kt delete mode 100644 js/js.translator/testFiles/tuple/cases/twoElements.kt diff --git a/compiler/testData/codegen/dataClasses/tostring/unitComponent.kt b/compiler/testData/codegen/dataClasses/tostring/unitComponent.kt index 0b6485cb03a..2b6314ef567 100644 --- a/compiler/testData/codegen/dataClasses/tostring/unitComponent.kt +++ b/compiler/testData/codegen/dataClasses/tostring/unitComponent.kt @@ -1,6 +1,6 @@ data class A(val x: Unit) fun box(): String { - val a = A(#()) - return if ("$a" == "A{x=()}") "OK" else "$a" + val a = A(Unit.VALUE) + return if ("$a" == "A{x=Unit.VALUE}") "OK" else "$a" } diff --git a/compiler/testData/codegen/dataClasses/unitComponent.kt b/compiler/testData/codegen/dataClasses/unitComponent.kt index 49046f4240e..0246cebd88a 100644 --- a/compiler/testData/codegen/dataClasses/unitComponent.kt +++ b/compiler/testData/codegen/dataClasses/unitComponent.kt @@ -1,6 +1,6 @@ data class A(val x: Unit) fun box(): String { - val a = A(#()) + val a = A(Unit.VALUE) return if (a.component1() is Unit) "OK" else "Fail ${a.component1()}" } diff --git a/compiler/testData/codegen/functions/defaultargs2.jet b/compiler/testData/codegen/functions/defaultargs2.jet index 1f2fa12d7b3..cf02fc34f39 100644 --- a/compiler/testData/codegen/functions/defaultargs2.jet +++ b/compiler/testData/codegen/functions/defaultargs2.jet @@ -1,3 +1,18 @@ +class T4( + val c1: Boolean, + val c2: Boolean, + val c3: Boolean, + val c4: String +) { + fun equals(o: Any?): Boolean { + if (o !is T4) return false; + return c1 == o.c1 && + c2 == o.c2 && + c3 == o.c3 && + c4 == o.c4 + } +} + fun reformat( str : String, normalizeCase : Boolean = true, @@ -5,11 +20,11 @@ fun reformat( divideByCamelHumps : Boolean = true, wordSeparator : String = " " ) = - #(normalizeCase, uppercaseFirstLetter, divideByCamelHumps, wordSeparator) + T4(normalizeCase, uppercaseFirstLetter, divideByCamelHumps, wordSeparator) fun box() : String { - val expected = #(true, true, true, " ") + val expected = T4(true, true, true, " ") if(reformat("", true, true, true, " ") != expected) return "fail" if(reformat("", true, true, true) != expected) return "fail" if(reformat("", true, true) != expected) return "fail" diff --git a/compiler/testData/codegen/regressions/kt1538.kt b/compiler/testData/codegen/regressions/kt1538.kt index 01635ec2279..44600392f3c 100644 --- a/compiler/testData/codegen/regressions/kt1538.kt +++ b/compiler/testData/codegen/regressions/kt1538.kt @@ -2,17 +2,17 @@ import java.util.HashMap fun parseCatalogs(hashMap: Any?) { val r = toHasMap(hashMap) - if (!r._1) { + if (!r.first) { return } - val nodes = r._2 + val nodes = r.second } -fun toHasMap(value: Any?): #(Boolean, HashMap?) { +fun toHasMap(value: Any?): Pair?> { if(value is HashMap<*, *>) { - return #(true, value as HashMap) + return Pair(true, value as HashMap) } - return #(false, null as HashMap?) + return Pair(false, null as HashMap?) } fun box() : String { diff --git a/compiler/testData/codegen/regressions/kt2062.kt b/compiler/testData/codegen/regressions/kt2062.kt index 169e193c0e7..4f0bce4a8a6 100644 --- a/compiler/testData/codegen/regressions/kt2062.kt +++ b/compiler/testData/codegen/regressions/kt2062.kt @@ -1,5 +1,5 @@ fun box(): String { val a = if(true) { } - return if (a.toString() == "()") "OK" else "fail" + return if (a.toString() == "Unit.VALUE") "OK" else "fail" } diff --git a/compiler/testData/codegen/regressions/kt237.jet b/compiler/testData/codegen/regressions/kt237.jet index c2867130740..cc96a0e9643 100644 --- a/compiler/testData/codegen/regressions/kt237.jet +++ b/compiler/testData/codegen/regressions/kt237.jet @@ -1,9 +1,9 @@ fun main(args: Array?) { - val y: Unit = #() //do not compile + val y: Unit = Unit.VALUE //do not compile A() //do not compile - C(#()) //do not compile + C(Unit.VALUE) //do not compile //do not compile - System.out?.println(fff(#())) //do not compile + System.out?.println(fff(Unit.VALUE)) //do not compile System.out?.println(id(y)) //do not compile System.out?.println(fff(id(y)) == id(foreach(Array(0,{0}),{(e : Int) : Unit -> }))) //do not compile } diff --git a/compiler/testData/codegen/regressions/kt344.jet b/compiler/testData/codegen/regressions/kt344.jet index 99f657592e1..cdec9809fde 100644 --- a/compiler/testData/codegen/regressions/kt344.jet +++ b/compiler/testData/codegen/regressions/kt344.jet @@ -27,7 +27,7 @@ fun t1() : Boolean { x = x + "45" + y x = x.substring(3) x += "aaa" - #() + Unit.VALUE } foo() @@ -43,7 +43,7 @@ fun t2() : Boolean { x = x + 5 + y x += 5 x++ - #() + Unit.VALUE } foo() x -= 55 @@ -55,7 +55,7 @@ fun t3() : Boolean { var x = true val foo = { x = false - #() + Unit.VALUE } foo() return !x @@ -67,7 +67,7 @@ fun t4() : Boolean { val foo = { x = x + 200.toFloat() + y x += 18 - #() + Unit.VALUE } foo() System.out?.println(x) @@ -80,7 +80,7 @@ fun t5() : Boolean { val foo = { x = x + 200.toDouble() + y x -= 22 - #() + Unit.VALUE } foo() System.out?.println(x) @@ -94,7 +94,7 @@ fun t6() : Boolean { x = (x + 20.toByte() + y).toByte() x += 2 x-- - #() + Unit.VALUE } foo() System.out?.println(x) @@ -105,7 +105,7 @@ fun t7() : Boolean { var x : Char = 'a' val foo = { x = 'b' - #() + Unit.VALUE } foo() System.out?.println(x) @@ -117,10 +117,10 @@ fun t8() : Boolean { val foo = { val bar = { x = 30.toShort() - #() + Unit.VALUE } bar() - #() + Unit.VALUE } foo() return x == 30.toShort() diff --git a/compiler/testData/codegen/tuples/basic.jet b/compiler/testData/codegen/tuples/basic.jet deleted file mode 100644 index ab51e54bb89..00000000000 --- a/compiler/testData/codegen/tuples/basic.jet +++ /dev/null @@ -1,6 +0,0 @@ -fun box() : String { - val a = #(1, "2") - if (a._1 != 1) return "Fail 1: ${a._1}" - if (a._2 != "2") return "Fail 1: ${a._2}" - return "OK" -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/Bounds.kt b/compiler/testData/diagnostics/tests/Bounds.kt index 39c6284401b..4f7f205fb64 100644 --- a/compiler/testData/diagnostics/tests/Bounds.kt +++ b/compiler/testData/diagnostics/tests/Bounds.kt @@ -18,7 +18,9 @@ package boundsWithSubstitutors open class A {} open class B() - abstract class CInt>, X : (B<Char>) -> #(B<Any>, B)>() : B<Any>() { // 2 errors + class Pair + + abstract class CInt>, X : (B<Char>) -> PairAny>, B>>() : B<Any>() { // 2 errors val a = B<Char>() // error abstract val x : (B<Char>) -> B<Any> diff --git a/compiler/testData/diagnostics/tests/Casts.kt b/compiler/testData/diagnostics/tests/Casts.kt index 186124aeb95..0dd2247542a 100644 --- a/compiler/testData/diagnostics/tests/Casts.kt +++ b/compiler/testData/diagnostics/tests/Casts.kt @@ -12,5 +12,5 @@ fun test() : Unit { y as? Int : Int? x as? Int? : Int? y as? Int? : Int? - #() + Unit.VALUE } diff --git a/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt b/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt index 27eb7d1eb95..1054a4828e3 100644 --- a/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt +++ b/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt @@ -4,7 +4,7 @@ fun unitEmptyInfer() {} fun unitEmpty() : Unit {} fun unitEmptyReturn() : Unit {return} fun unitIntReturn() : Unit {return 1} -fun unitUnitReturn() : Unit {return #()} +fun unitUnitReturn() : Unit {return Unit.VALUE} fun test1() : Any = {return} fun test2() : Any = @a {return@a 1} fun test3() : Any { return } @@ -25,7 +25,7 @@ fun foo(expr: StringBuilder): Int { } -fun unitShort() : Unit = #() +fun unitShort() : Unit = Unit.VALUE fun unitShortConv() : Unit = 1 fun unitShortNull() : Unit = null @@ -42,7 +42,7 @@ fun intFunctionLiteral(): Int = { 10 } fun blockReturnUnitMismatch() : Int {return} fun blockReturnValueTypeMismatch() : Int {return 3.4} fun blockReturnValueTypeMatch() : Int {return 1} -fun blockReturnValueTypeMismatchUnit() : Int {return #()} +fun blockReturnValueTypeMismatchUnit() : Int {return Unit.VALUE} fun blockAndAndMismatch() : Int { true && false diff --git a/compiler/testData/diagnostics/tests/LValueAssignment.kt b/compiler/testData/diagnostics/tests/LValueAssignment.kt index 5411031f893..79bba0a6e66 100644 --- a/compiler/testData/diagnostics/tests/LValueAssignment.kt +++ b/compiler/testData/diagnostics/tests/LValueAssignment.kt @@ -36,9 +36,12 @@ class D() { } } +fun foo(): Unit {} + fun cannotBe(var i: Int) { z = 30; - #() = #(); + "" = ""; + foo() = Unit.VALUE; (i as Int) = 34 (i is Int) = false diff --git a/compiler/testData/diagnostics/tests/Nullability.kt b/compiler/testData/diagnostics/tests/Nullability.kt index 07ec8334475..ef418de3b99 100644 --- a/compiler/testData/diagnostics/tests/Nullability.kt +++ b/compiler/testData/diagnostics/tests/Nullability.kt @@ -38,28 +38,28 @@ fun test() { out.println(); } - if (out == null || out.println(0) == #()) { + if (out == null || out.println(0) == Unit.VALUE) { out?.println(1) } else { out.println(2) } - if (out != null && out.println() == #()) { + if (out != null && out.println() == Unit.VALUE) { out.println(); } else { out?.println(); } - if (out == null || out.println() == #()) { + if (out == null || out.println() == Unit.VALUE) { out?.println(); } else { out.println(); } - if (1 == 2 || out != null && out.println(1) == #()) { + if (1 == 2 || out != null && out.println(1) == Unit.VALUE) { out?.println(2); } else { @@ -94,28 +94,28 @@ fun test() { out.println(); } - if (out == null || out.println(0) == #()) { + if (out == null || out.println(0) == Unit.VALUE) { out?.println(1) } else { out.println(2) } - if (out != null && out.println() == #()) { + if (out != null && out.println() == Unit.VALUE) { out.println(); } else { out?.println(); } - if (out == null || out.println() == #()) { + if (out == null || out.println() == Unit.VALUE) { out?.println(); } else { out.println(); } - if (1 == 2 || out != null && out.println(1) == #()) { + if (1 == 2 || out != null && out.println(1) == Unit.VALUE) { out?.println(2); } else { diff --git a/compiler/testData/diagnostics/tests/Super.kt b/compiler/testData/diagnostics/tests/Super.kt index 8301197932d..3aeca7d9493 100644 --- a/compiler/testData/diagnostics/tests/Super.kt +++ b/compiler/testData/diagnostics/tests/Super.kt @@ -34,7 +34,7 @@ class A() : C(), T { super<Int>.foo() super<>.foo() super<() -> Unit>.foo() - super<#()>.foo() + super<Unit>.foo() super@B.foo() super@B.bar() } diff --git a/compiler/testData/diagnostics/tests/Unresolved.kt b/compiler/testData/diagnostics/tests/Unresolved.kt index 3366a449d88..9514b112c74 100644 --- a/compiler/testData/diagnostics/tests/Unresolved.kt +++ b/compiler/testData/diagnostics/tests/Unresolved.kt @@ -1,8 +1,10 @@ package unresolved +class Pair(val a: A, val b: B) + fun testGenericArgumentsCount() { - val p1: Tuple2 = #(2, 2) - val p2: Tuple2 = #(2, 2) + val p1: Pair = Pair(2, 2) + val p2: Pair = Pair(2, 2) } fun testUnresolved() { diff --git a/compiler/testData/diagnostics/tests/When.kt b/compiler/testData/diagnostics/tests/When.kt index 50410cb1647..7cded35b7e3 100644 --- a/compiler/testData/diagnostics/tests/When.kt +++ b/compiler/testData/diagnostics/tests/When.kt @@ -41,6 +41,4 @@ fun test() { when (z) { else -> 1 } -} - -val #(Int, Int).boo : #(Int, Int, Int) = #(1, 1, 1) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/controlStructures/kt657.kt b/compiler/testData/diagnostics/tests/controlStructures/kt657.kt index bab366fb5df..82ba5ac1a81 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/kt657.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/kt657.kt @@ -1,12 +1,14 @@ //KT-657 Semantic checks for when without condition package kt657 +class Pair(a: A, b: B) + fun foo() = when { cond1() -> 12 cond2() -> 2 4 -> 34 - #(1, 2) -> 3 + Pair(1, 2) -> 3 in 1..10 -> 34 4 -> 38 is Int -> 33 diff --git a/compiler/testData/diagnostics/tests/controlStructures/when.kt234.kt973.kt b/compiler/testData/diagnostics/tests/controlStructures/when.kt234.kt973.kt index ff227c754f5..9fd46a066a1 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/when.kt234.kt973.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/when.kt234.kt973.kt @@ -3,17 +3,18 @@ package kt234_kt973 +class Pair(a: A, b: B) -fun test(t : #(Int, Int)) : Int { +fun test(t : Pair) : Int { when (t) { - #(10, 10) -> return 1 + Pair(10, 10) -> return 1 } return 0 // unreachable code } -fun test1(t : #(Int, Int)) : Int { +fun test1(t : Pair) : Int { when (t) { - #(10, 10) -> return 1 + Pair(10, 10) -> return 1 else -> return 2 } return 0 // unreachable code diff --git a/compiler/testData/diagnostics/tests/dataFlow/TupleExpression.kt b/compiler/testData/diagnostics/tests/dataFlow/TupleExpression.kt deleted file mode 100644 index e1707933b42..00000000000 --- a/compiler/testData/diagnostics/tests/dataFlow/TupleExpression.kt +++ /dev/null @@ -1,7 +0,0 @@ -class C(val f : Int) - -fun test(e : Any) { - if (e is C) { - #(e.f) - } -} diff --git a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt index 5d686699a92..2793a85541e 100644 --- a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt +++ b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt @@ -2,7 +2,7 @@ package outer fun Int?.optint() : Unit {} -val Int?.optval : Unit = #() +val Int?.optval : Unit = Unit.VALUE fun T.foo(x : E, y : A) : T { y.plus(1) diff --git a/compiler/testData/diagnostics/tests/infos/Autocasts.kt b/compiler/testData/diagnostics/tests/infos/Autocasts.kt index 2cd34dd2ef8..053ee48f6f4 100644 --- a/compiler/testData/diagnostics/tests/infos/Autocasts.kt +++ b/compiler/testData/diagnostics/tests/infos/Autocasts.kt @@ -20,7 +20,7 @@ fun f9(init : A?) { a?.bar() a?.foo() } - if (!(a is B) || a.bar() == #()) { + if (!(a is B) || a.bar() == Unit.VALUE) { a?.bar() } if (!(a is B)) { @@ -102,7 +102,7 @@ fun f13(a : A?) { } a?.foo() - if (a is B && a.foo() == #()) { + if (a is B && a.foo() == Unit.VALUE) { a.foo() a.bar() } @@ -153,7 +153,7 @@ fun illegalWhenBlock(a: Any): Int { } fun declarations(a: Any?) { if (a is String) { - val p4: #(Int, String) = #(2, a) + val p4: String = a } if (a is String?) { if (a != null) { @@ -172,25 +172,6 @@ fun vars(a: Any?) { b = a } } -fun tuples(a: Any?) { - if (a != null) { - val s: #(Any, String) = #(a, a) - } - if (a is String) { - val s: #(Any, String) = #(a, a) - } - fun illegalTupleReturnType(): #(Any, String) = #(a, a) - if (a is String) { - fun legalTupleReturnType(): #(Any, String) = #(a, a) - } - val illegalFunctionLiteral: Function0 = { a } - val illegalReturnValueInFunctionLiteral: Function0 = { (): Int -> a } - - if (a is Int) { - val legalFunctionLiteral: Function0 = { a } - val alsoLegalFunctionLiteral: Function0 = { (): Int -> a } - } -} fun returnFunctionLiteralBlock(a: Any?): Function0 { if (a is Int) return { a } else return { 1 } @@ -199,8 +180,6 @@ fun returnFunctionLiteral(a: Any?): Function0 = if (a is Int) { (): Int -> a } else { () -> 1 } -fun illegalTupleReturnType(a: Any): #(Any, String) = #(a, a) - fun mergeAutocasts(a: Any?) { if (a is String || a is Int) { a.compareTo("") diff --git a/compiler/testData/diagnostics/tests/j+k/OverrideVararg.kt b/compiler/testData/diagnostics/tests/j+k/OverrideVararg.kt index e90852f6637..428e4005c7a 100644 --- a/compiler/testData/diagnostics/tests/j+k/OverrideVararg.kt +++ b/compiler/testData/diagnostics/tests/j+k/OverrideVararg.kt @@ -8,5 +8,5 @@ public abstract class Aaa { // FILE: bbb.kt class Bbb() : Aaa() { - override fun foo(vararg args: String?) = #() + override fun foo(vararg args: String?) = Unit.VALUE } diff --git a/compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/kt2234.kt b/compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/kt2234.kt index b44cb01a354..3898cada328 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/kt2234.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/kt2234.kt @@ -2,11 +2,13 @@ package a //KT-2234 'period!!' has type Int? +class Pair(val a: A, val b: B) + fun main(args : Array) { val d : Long = 1 val period : Int? = null - if (period != null) #(d, period!! : Int) else #(d, 1) - if (period != null) #(d, period : Int) else #(d, 1) + if (period != null) Pair(d, period!! : Int) else Pair(d, 1) + if (period != null) Pair(d, period : Int) else Pair(d, 1) } fun foo() { diff --git a/compiler/testData/diagnostics/tests/override/EqualityOfIntersectionTypes.kt b/compiler/testData/diagnostics/tests/override/EqualityOfIntersectionTypes.kt index 33c380bc350..fd53cf12a9f 100644 --- a/compiler/testData/diagnostics/tests/override/EqualityOfIntersectionTypes.kt +++ b/compiler/testData/diagnostics/tests/override/EqualityOfIntersectionTypes.kt @@ -4,12 +4,12 @@ trait Bar trait A { fun foo() where T : Foo, T : Bar - = #() + = Unit.VALUE } class B : A { override fun foo() where T : Foo, T : Bar - = #() + = Unit.VALUE } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/override/NonGenerics.kt b/compiler/testData/diagnostics/tests/override/NonGenerics.kt index f61c506e0ad..345a3073a14 100644 --- a/compiler/testData/diagnostics/tests/override/NonGenerics.kt +++ b/compiler/testData/diagnostics/tests/override/NonGenerics.kt @@ -15,8 +15,8 @@ open class MyClass() : MyTrait, MyAbstractClass() { override fun foo() {} override fun bar() {} - override val pr : Unit = #() - override val prr : Unit = #() + override val pr : Unit = Unit.VALUE + override val prr : Unit = Unit.VALUE } class MyChildClass() : MyClass() {} @@ -25,14 +25,14 @@ class MyIllegalClass : MyTrait, MyAbstract class MyIllegalClass2() : MyTrait, MyAbstractClass() { override fun foo() {} - override val pr : Unit = #() - override val prr : Unit = #() + override val pr : Unit = Unit.VALUE + override val prr : Unit = Unit.VALUE } class MyIllegalClass3() : MyTrait, MyAbstractClass() { override fun bar() {} - override val pr : Unit = #() - override val prr : Unit = #() + override val pr : Unit = Unit.VALUE + override val prr : Unit = Unit.VALUE } class MyIllegalClass4() : MyTrait, MyAbstractClass() { @@ -44,7 +44,7 @@ class MyIllegalClass4() : MyTrait, MyAbstr class MyChildClass1() : MyClass() { fun foo() {} - val pr : Unit = #() + val pr : Unit = Unit.VALUE override fun bar() {} - override val prr : Unit = #() + override val prr : Unit = Unit.VALUE } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt353.kt b/compiler/testData/diagnostics/tests/regressions/kt353.kt index 0b62948ba27..a986e31c000 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt353.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt353.kt @@ -20,7 +20,7 @@ fun foo(a: A) { a.gen() // unit can be inferred } else { - #() + Unit.VALUE } } diff --git a/compiler/testData/diagnostics/tests/subtyping/kt-1457.kt b/compiler/testData/diagnostics/tests/subtyping/kt-1457.kt index 29d85aa962a..88d34e3f63c 100644 --- a/compiler/testData/diagnostics/tests/subtyping/kt-1457.kt +++ b/compiler/testData/diagnostics/tests/subtyping/kt-1457.kt @@ -1,7 +1,9 @@ import java.util.ArrayList -class MyListOfPairs : ArrayList<#(T, T)>() { } +class Pair(val a: A, val b: B) + +class MyListOfPairs : ArrayList>() { } fun test() { - MyListOfPairs() : ArrayList<#(Int, Int)> + MyListOfPairs() : ArrayList> } diff --git a/compiler/testData/diagnostics/tests/tuples/BasicTuples.kt b/compiler/testData/diagnostics/tests/tuples/BasicTuples.kt deleted file mode 100644 index fac1a06d005..00000000000 --- a/compiler/testData/diagnostics/tests/tuples/BasicTuples.kt +++ /dev/null @@ -1,4 +0,0 @@ -fun foo(a : #(Int, String)) { - a._1 : Int - a._2 : String -} diff --git a/compiler/testData/loadJava/MethodTypePOneUpperBound.kt b/compiler/testData/loadJava/MethodTypePOneUpperBound.kt index 2ca41c64c99..f9d94a8e6d4 100644 --- a/compiler/testData/loadJava/MethodTypePOneUpperBound.kt +++ b/compiler/testData/loadJava/MethodTypePOneUpperBound.kt @@ -1,5 +1,5 @@ package test public open class MethodTypePOneUpperBound() : java.lang.Object() { - public open fun bar() : Unit = #() + public open fun bar() : Unit = Unit.VALUE } diff --git a/compiler/testData/loadJava/MethodWithTypeP.kt b/compiler/testData/loadJava/MethodWithTypeP.kt index 274c3fe0b30..f8607ada2ed 100644 --- a/compiler/testData/loadJava/MethodWithTypeP.kt +++ b/compiler/testData/loadJava/MethodWithTypeP.kt @@ -1,5 +1,5 @@ package test public class MethodWithTypeP() : java.lang.Object() { - public fun

f() : Unit = #() + public fun

f() : Unit = Unit.VALUE } diff --git a/compiler/testData/loadJava/MethodWithTypePP.kt b/compiler/testData/loadJava/MethodWithTypePP.kt index 0fc1e73f2ab..de7bbff43fe 100644 --- a/compiler/testData/loadJava/MethodWithTypePP.kt +++ b/compiler/testData/loadJava/MethodWithTypePP.kt @@ -1,5 +1,5 @@ package test public class MethodWithTypePP() : java.lang.Object() { - public fun f() : Unit = #() + public fun f() : Unit = Unit.VALUE } diff --git a/compiler/testData/loadJava/MethodWithTypePRefClassP.kt b/compiler/testData/loadJava/MethodWithTypePRefClassP.kt index 61f6e06ad72..79ca5eb33bf 100644 --- a/compiler/testData/loadJava/MethodWithTypePRefClassP.kt +++ b/compiler/testData/loadJava/MethodWithTypePRefClassP.kt @@ -1,5 +1,5 @@ package test public open class MethodWithTypePRefClassP

() : java.lang.Object() { - public fun f() : Unit = #() + public fun f() : Unit = Unit.VALUE } diff --git a/compiler/testData/loadJava/MethosWithPRefTP.kt b/compiler/testData/loadJava/MethosWithPRefTP.kt index 974ea3f9e59..2fed7f5b4e8 100644 --- a/compiler/testData/loadJava/MethosWithPRefTP.kt +++ b/compiler/testData/loadJava/MethosWithPRefTP.kt @@ -1,5 +1,5 @@ package test public final class MethosWithPRefTP() : java.lang.Object() { - public fun

f(p0: P?) : Unit = #() + public fun

f(p0: P?) : Unit = Unit.VALUE } diff --git a/compiler/testData/loadJava/vararg/VarargInt.kt b/compiler/testData/loadJava/vararg/VarargInt.kt index b76312d69de..01574c53407 100644 --- a/compiler/testData/loadJava/vararg/VarargInt.kt +++ b/compiler/testData/loadJava/vararg/VarargInt.kt @@ -1,5 +1,5 @@ package test public open class VarargInt() : java.lang.Object() { - public open fun vararg(vararg p0: Int): Unit = #() + public open fun vararg(vararg p0: Int): Unit = Unit.VALUE } diff --git a/compiler/testData/loadJava/vararg/VarargString.kt b/compiler/testData/loadJava/vararg/VarargString.kt index b624bea5042..657b08c7a98 100644 --- a/compiler/testData/loadJava/vararg/VarargString.kt +++ b/compiler/testData/loadJava/vararg/VarargString.kt @@ -1,5 +1,5 @@ package test public open class VarargString() : java.lang.Object() { - public open fun vararg(vararg p0: String?): Unit = #() + public open fun vararg(vararg p0: String?): Unit = Unit.VALUE } diff --git a/compiler/testData/loadKotlin/fun/genericWithTypeVariables/FunParamTwoUpperBounds.kt b/compiler/testData/loadKotlin/fun/genericWithTypeVariables/FunParamTwoUpperBounds.kt index cc7759ea454..d1d002397aa 100644 --- a/compiler/testData/loadKotlin/fun/genericWithTypeVariables/FunParamTwoUpperBounds.kt +++ b/compiler/testData/loadKotlin/fun/genericWithTypeVariables/FunParamTwoUpperBounds.kt @@ -5,4 +5,4 @@ trait Bar fun foo() where T : Foo, T : Bar - = #() + = Unit.VALUE diff --git a/compiler/testData/loadKotlin/type/Tuple0.kt b/compiler/testData/loadKotlin/type/Tuple0.kt index 9464c20c380..35080851976 100644 --- a/compiler/testData/loadKotlin/type/Tuple0.kt +++ b/compiler/testData/loadKotlin/type/Tuple0.kt @@ -1,3 +1,3 @@ package test -fun tuple0() = #() +fun tuple0() = Unit.VALUE diff --git a/compiler/testData/renderer/TupleTypes.kt b/compiler/testData/renderer/TupleTypes.kt index 184bf00bc9f..82b6a11e91d 100644 --- a/compiler/testData/renderer/TupleTypes.kt +++ b/compiler/testData/renderer/TupleTypes.kt @@ -2,20 +2,8 @@ var v1 : Tuple0 var v2 : Tuple0? var v3 : Unit var v4 : Unit? -var v5 : #() -var v6 : #(Int) -var v7 : #(Int)? -var v8 : #(Int, String, String) -var v9 : Tuple2 -var v10 : Tuple3? //internal final var v1 : Unit defined in root package //internal final var v2 : Unit? defined in root package //internal final var v3 : Unit defined in root package //internal final var v4 : Unit? defined in root package -//internal final var v5 : Unit defined in root package -//internal final var v6 : #(jet.Int) defined in root package -//internal final var v7 : #(jet.Int)? defined in root package -//internal final var v8 : #(jet.Int, jet.String, jet.String) defined in root package -//internal final var v9 : #(jet.Int, jet.String) defined in root package -//internal final var v10 : #(jet.Int, jet.Int, jet.Int)? defined in root package diff --git a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java index 76f40268bdb..1d81706f7a6 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java @@ -1085,11 +1085,6 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage doTest("compiler/testData/diagnostics/tests/dataFlow/IsExpression.kt"); } - @TestMetadata("TupleExpression.kt") - public void testTupleExpression() throws Exception { - doTest("compiler/testData/diagnostics/tests/dataFlow/TupleExpression.kt"); - } - @TestMetadata("WhenSubject.kt") public void testWhenSubject() throws Exception { doTest("compiler/testData/diagnostics/tests/dataFlow/WhenSubject.kt"); @@ -3273,11 +3268,6 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.checkers.AbstractDiagnosticsTestWithEagerResolve", new File("compiler/testData/diagnostics/tests/tuples"), "kt", true); } - @TestMetadata("BasicTuples.kt") - public void testBasicTuples() throws Exception { - doTest("compiler/testData/diagnostics/tests/tuples/BasicTuples.kt"); - } - @TestMetadata("UnitValue.kt") public void testUnitValue() throws Exception { doTest("compiler/testData/diagnostics/tests/tuples/UnitValue.kt"); diff --git a/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java index 066ed9d83e1..e400c98c9cb 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java @@ -441,7 +441,7 @@ public class ClassGenTest extends CodegenTestCase { } public void testKt1538() throws Exception { - createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY); + createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.ALL); blackBoxFile("regressions/kt1538.kt"); } diff --git a/compiler/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java index 1671d1d23f5..17e5c201e4b 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java @@ -17,15 +17,12 @@ package org.jetbrains.jet.codegen; import jet.IntRange; -import jet.Tuple2; -import jet.Tuple4; import org.jetbrains.jet.ConfigurationKind; import java.awt.*; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; -import java.util.Arrays; /** * @author yole @@ -507,25 +504,6 @@ public class NamespaceGenTest extends CodegenTestCase { assertEquals("JetLanguage", list.get(0)); } - public void testTupleLiteral() throws Exception { - loadText("fun foo() = #(1, \"foo\")"); -// System.out.println(generateToText()); - final Method main = generateFunction("foo"); - Tuple2 tuple2 = (Tuple2) main.invoke(null); - assertEquals(1, tuple2._1); - assertEquals("foo", tuple2._2); - } - - public void testParametrizedTupleLiteral() throws Exception { - loadText("fun E.foo(extra: java.util.List) = #(1, \"foo\", this, extra)"); -// System.out.println(generateToText()); - final Method main = generateFunction(); - Tuple4 tuple4 = (Tuple4) main.invoke(null, "aaa", Arrays.asList(10)); - assertEquals(1, tuple4._1); - assertEquals("foo", tuple4._2); - assertEquals("aaa", tuple4._3); - } - public void testEscapeSequence() throws Exception { loadText("fun foo() = \"a\\nb\\$\""); final Method main = generateFunction(); diff --git a/compiler/tests/org/jetbrains/jet/codegen/TupleGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/TupleGenTest.java index 61bd26b809a..f5025677477 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/TupleGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/TupleGenTest.java @@ -19,11 +19,6 @@ package org.jetbrains.jet.codegen; import org.jetbrains.jet.ConfigurationKind; public class TupleGenTest extends CodegenTestCase { - public void testBasic() { - createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY); - blackBoxFile("/tuples/basic.jet"); -// System.out.println(generateToText()); - } public void testUnitValue() { createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY); diff --git a/idea/testData/checker/Bounds.jet b/idea/testData/checker/Bounds.jet index d01aaf4e6bc..06742fab9b8 100644 --- a/idea/testData/checker/Bounds.jet +++ b/idea/testData/checker/Bounds.jet @@ -1,7 +1,9 @@ open class A {} open class B() - abstract class CInt>, X : (B<Char>) -> #(B<Any>, B)>() : B<Any>() { // 2 errors + class Pair + + abstract class CInt>, X : (B<Char>) -> PairAny>, B>>() : B<Any>() { // 2 errors val a = B<Char>() // error abstract val x : (B<Char>) -> B<Any> diff --git a/idea/testData/checker/Casts.jet b/idea/testData/checker/Casts.jet index fbd29ea06b3..d6203aec635 100644 --- a/idea/testData/checker/Casts.jet +++ b/idea/testData/checker/Casts.jet @@ -12,5 +12,5 @@ fun test() : Unit { y as? Int : Int? x as? Int? : Int? y as? Int? : Int? - #() + Unit.VALUE } \ No newline at end of file diff --git a/idea/testData/checker/ExtensionFunctions.jet b/idea/testData/checker/ExtensionFunctions.jet index df72388de3d..6b7b018e0ec 100644 --- a/idea/testData/checker/ExtensionFunctions.jet +++ b/idea/testData/checker/ExtensionFunctions.jet @@ -1,5 +1,5 @@ fun Int?.optint() : Unit {} -val Int?.optval : Unit = #() +val Int?.optval : Unit = Unit.VALUE fun T.foo(x : E, y : A) : T { y.plus(1) diff --git a/idea/testData/checker/FunctionReturnTypes.jet b/idea/testData/checker/FunctionReturnTypes.jet index ef3ca6807b1..9ccd9e1288a 100644 --- a/idea/testData/checker/FunctionReturnTypes.jet +++ b/idea/testData/checker/FunctionReturnTypes.jet @@ -4,7 +4,7 @@ fun unitEmptyInfer() {} fun unitEmpty() : Unit {} fun unitEmptyReturn() : Unit {return} fun unitIntReturn() : Unit {return 1} -fun unitUnitReturn() : Unit {return #()} +fun unitUnitReturn() : Unit {return Unit.VALUE} fun test1() : Any = { return } fun test2() : Any = @a {return@a 1} fun test3() : Any { return } @@ -22,7 +22,7 @@ fun foo(expr: StringBuilder): Int { } -fun unitShort() : Unit = #() +fun unitShort() : Unit = Unit.VALUE fun unitShortConv() : Unit = 1 fun unitShortNull() : Unit = null @@ -39,7 +39,7 @@ fun intFunctionLiteral(): Int = { 10 } fun blockReturnUnitMismatch() : Int {return} fun blockReturnValueTypeMismatch() : Int {return 3.4} fun blockReturnValueTypeMatch() : Int {return 1} -fun blockReturnValueTypeMismatchUnit() : Int {return #()} +fun blockReturnValueTypeMismatchUnit() : Int {return Unit.VALUE} fun blockAndAndMismatch() : Int { true && false diff --git a/idea/testData/checker/Nullability.jet b/idea/testData/checker/Nullability.jet index 07ec8334475..ef418de3b99 100644 --- a/idea/testData/checker/Nullability.jet +++ b/idea/testData/checker/Nullability.jet @@ -38,28 +38,28 @@ fun test() { out.println(); } - if (out == null || out.println(0) == #()) { + if (out == null || out.println(0) == Unit.VALUE) { out?.println(1) } else { out.println(2) } - if (out != null && out.println() == #()) { + if (out != null && out.println() == Unit.VALUE) { out.println(); } else { out?.println(); } - if (out == null || out.println() == #()) { + if (out == null || out.println() == Unit.VALUE) { out?.println(); } else { out.println(); } - if (1 == 2 || out != null && out.println(1) == #()) { + if (1 == 2 || out != null && out.println(1) == Unit.VALUE) { out?.println(2); } else { @@ -94,28 +94,28 @@ fun test() { out.println(); } - if (out == null || out.println(0) == #()) { + if (out == null || out.println(0) == Unit.VALUE) { out?.println(1) } else { out.println(2) } - if (out != null && out.println() == #()) { + if (out != null && out.println() == Unit.VALUE) { out.println(); } else { out?.println(); } - if (out == null || out.println() == #()) { + if (out == null || out.println() == Unit.VALUE) { out?.println(); } else { out.println(); } - if (1 == 2 || out != null && out.println(1) == #()) { + if (1 == 2 || out != null && out.println(1) == Unit.VALUE) { out?.println(2); } else { diff --git a/idea/testData/checker/Unresolved.jet b/idea/testData/checker/Unresolved.jet index 95228d79b6e..fa2b655f6f4 100644 --- a/idea/testData/checker/Unresolved.jet +++ b/idea/testData/checker/Unresolved.jet @@ -1,8 +1,10 @@ package unresolved +class Pair(a: A, b: B) + fun testGenericArgumentsCount() { - val p1: Tuple2 = #(2, 2) - val p2: Tuple2 = #(2, 2) + val p1: Pair = Pair(2, 2) + val p2: Pair = Pair(2, 2) } fun testUnresolved() { diff --git a/idea/testData/checker/When.jet b/idea/testData/checker/When.jet index 70e7a0b0148..48adeae647d 100644 --- a/idea/testData/checker/When.jet +++ b/idea/testData/checker/When.jet @@ -42,6 +42,4 @@ fun test() { when (z) { else -> 1 } -} - -val #(Int, Int).boo : #(Int, Int, Int) = #(1, 1, 1) +} \ No newline at end of file diff --git a/idea/testData/checker/infos/Autocasts.jet b/idea/testData/checker/infos/Autocasts.jet index adfe94ac032..dde367eab2a 100644 --- a/idea/testData/checker/infos/Autocasts.jet +++ b/idea/testData/checker/infos/Autocasts.jet @@ -19,7 +19,7 @@ fun f9(a : A?) { a?.bar() a?.foo() } - if (!(a is B) || a.bar() == #()) { + if (!(a is B) || a.bar() == Unit.VALUE) { a?.bar() } if (!(a is B)) { @@ -97,7 +97,7 @@ fun f13(a : A?) { } a?.foo() - if (a is B && a.foo() == #()) { + if (a is B && a.foo() == Unit.VALUE) { a.foo() a.bar() } @@ -149,7 +149,7 @@ fun illegalWhenBlock(a: Any): Int { } fun declarations(a: Any?) { if (a is String) { - val p4: #(Int, String) = #(2, a) + val p4: String = a } if (a is String?) { if (a != null) { @@ -168,25 +168,6 @@ fun vars(a: Any?) { b = a } } -fun tuples(a: Any?) { - if (a != null) { - val s: #(Any, String) = #(a, a) - } - if (a is String) { - val s: #(Any, String) = #(a, a) - } - fun illegalTupleReturnType(): #(Any, String) = #(a, a) - if (a is String) { - fun legalTupleReturnType(): #(Any, String) = #(a, a) - } - val illegalFunctionLiteral: Function0 = { a } - val illegalReturnValueInFunctionLiteral: Function0 = { (): Int -> a } - - if (a is Int) { - val legalFunctionLiteral: Function0 = { a } - val alsoLegalFunctionLiteral: Function0 = { (): Int -> a } - } -} fun returnFunctionLiteralBlock(a: Any?): Function0 { if (a is Int) return { a } else return { 1 } @@ -195,8 +176,6 @@ fun returnFunctionLiteral(a: Any?): Function0 = if (a is Int) { (): Int -> a } else { () -> 1 } -fun illegalTupleReturnType(a: Any): #(Any, String) = #(a, a) - fun mergeAutocasts(a: Any?) { if (a is String || a is Int) { a.compareTo("") diff --git a/idea/testData/intentions/specifyType/afterUnitType.kt b/idea/testData/intentions/specifyType/afterUnitType.kt index 7e29d4b7520..8f868d0e08f 100644 --- a/idea/testData/intentions/specifyType/afterUnitType.kt +++ b/idea/testData/intentions/specifyType/afterUnitType.kt @@ -1,2 +1,2 @@ // "Specify Type Explicitly" "true" -val x: Unit = #() \ No newline at end of file +val x: Unit = Unit.VALUE \ No newline at end of file diff --git a/idea/testData/intentions/specifyType/beforeUnitType.kt b/idea/testData/intentions/specifyType/beforeUnitType.kt index 666a1e4b64f..71731938f29 100644 --- a/idea/testData/intentions/specifyType/beforeUnitType.kt +++ b/idea/testData/intentions/specifyType/beforeUnitType.kt @@ -1,2 +1,2 @@ // "Specify Type Explicitly" "true" -val x = #() \ No newline at end of file +val x = Unit.VALUE \ No newline at end of file diff --git a/idea/testData/libraries/decompiled/namespace.kt b/idea/testData/libraries/decompiled/namespace.kt index 7357f1b34c7..e7811bb88af 100644 --- a/idea/testData/libraries/decompiled/namespace.kt +++ b/idea/testData/libraries/decompiled/namespace.kt @@ -3,13 +3,13 @@ package testData.libraries -[public final val #(T, T).exProp : jet.String] /* compiled code */ - [public final val jet.Int.exProp : jet.Int] /* compiled code */ [public final val jet.String.exProp : jet.String] /* compiled code */ -[public final val globalVal : #(jet.Int, jet.String)] /* compiled code */ +[public final val testData.libraries.Pair.exProp : jet.String] /* compiled code */ + +[public final val globalVal : testData.libraries.Pair] /* compiled code */ [public final val globalValWithGetter : jet.Long] /* compiled code */ diff --git a/idea/testData/libraries/library/main.kt b/idea/testData/libraries/library/main.kt index a50bbab3605..d6c7eb39369 100644 --- a/idea/testData/libraries/library/main.kt +++ b/idea/testData/libraries/library/main.kt @@ -1,5 +1,7 @@ package testData.libraries +public class Pair(val first: A, val second: B) + public trait SimpleTrait { } @@ -60,7 +62,7 @@ public abstract class ClassWithAbstractAndOpenMembers { public fun main(args : Array) { } -public val globalVal : #(Int, String) = #(239, "239") +public val globalVal : Pair = Pair(239, "239") public val globalValWithGetter : Long get() { @@ -77,9 +79,9 @@ get() { return this } -public val #(T, T).exProp : String +public val Pair.exProp : String get() { - return "${this._1} : ${this._2}" + return "${this.first} : ${this.second}" } public fun func(a : Int, b : String = "55") { diff --git a/idea/testData/libraries/usercode/ExtensionProperty.kt b/idea/testData/libraries/usercode/ExtensionProperty.kt index 38f9d1886e9..9a8bc7441d2 100644 --- a/idea/testData/libraries/usercode/ExtensionProperty.kt +++ b/idea/testData/libraries/usercode/ExtensionProperty.kt @@ -2,7 +2,8 @@ import testData.libraries.* fun foo() { println("".exProp) - println(#(1, 2).exProp) + val p = Pair(1, 2) + println(p.exProp) } // main.kt @@ -16,4 +17,4 @@ fun foo() { // return this //} // -//public val #(T, T).<2>exProp : String \ No newline at end of file +//public val Pair.<2>exProp : String \ No newline at end of file diff --git a/idea/testData/libraries/usercode/GlobalProperty.kt b/idea/testData/libraries/usercode/GlobalProperty.kt index 6c675f5b2ed..811cdf85c03 100644 --- a/idea/testData/libraries/usercode/GlobalProperty.kt +++ b/idea/testData/libraries/usercode/GlobalProperty.kt @@ -6,6 +6,6 @@ fun foo() { } // main.kt -//public val <1>globalVal : #(Int, String) = #(239, "239") +//public val <1>globalVal : Pair = Pair(239, "239") // //public val <2>globalValWithGetter : Long \ No newline at end of file diff --git a/idea/testData/resolve/std/unit.kt b/idea/testData/resolve/std/unit.kt index 9e42d93b7ba..52cacf55e73 100644 --- a/idea/testData/resolve/std/unit.kt +++ b/idea/testData/resolve/std/unit.kt @@ -1,2 +1,2 @@ var x : Unit? -//jet.src/Tuples.jet:Tuple0 \ No newline at end of file +//jet.src/Unit.jet:Tuple0 \ No newline at end of file diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/TupleTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/TupleTest.java deleted file mode 100644 index b938748fe17..00000000000 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/TupleTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2010-2012 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.k2js.test.semantics; - -import org.jetbrains.k2js.test.SingleFileTranslationTest; - -/** - * @author Pavel Talanov - */ -public final class TupleTest extends SingleFileTranslationTest { - - - public TupleTest() { - super("tuple/"); - } - - public void testTwoElements() throws Exception { - fooBoxTest(); - } - - public void testMultipleMembers() throws Exception { - fooBoxTest(); - } - - public void testTuplesEquals() throws Exception { - fooBoxTest(); - } - - -} - diff --git a/js/js.translator/testFiles/additional/cases/defaultargs2.jet b/js/js.translator/testFiles/additional/cases/defaultargs2.jet index 0c708f35dd8..f780965ad43 100644 --- a/js/js.translator/testFiles/additional/cases/defaultargs2.jet +++ b/js/js.translator/testFiles/additional/cases/defaultargs2.jet @@ -1,3 +1,18 @@ +class T4( + val c1: Boolean, + val c2: Boolean, + val c3: Boolean, + val c4: String +) { + fun equals(o: Any?): Boolean { + if (o !is T4) return false; + return c1 == o.c1 && + c2 == o.c2 && + c3 == o.c3 && + c4 == o.c4 + } +} + fun reformat( str : String, normalizeCase : Boolean = true, @@ -5,11 +20,11 @@ fun reformat( divideByCamelHumps : Boolean = true, wordSeparator : String = " " ) = - #(normalizeCase, uppercaseFirstLetter, divideByCamelHumps, wordSeparator) + T4(normalizeCase, uppercaseFirstLetter, divideByCamelHumps, wordSeparator) fun box() : String { - val expected = #(true, true, true, " ") + val expected = T4(true, true, true, " ") if(reformat("", true, true, true, " ") != expected) return "fail1" if(reformat("", true, true, true) != expected) return "fail2" if(reformat("", true, true) != expected) return "fail3" diff --git a/js/js.translator/testFiles/tuple/cases/multipleMembers.kt b/js/js.translator/testFiles/tuple/cases/multipleMembers.kt deleted file mode 100644 index 3bf9c6eb000..00000000000 --- a/js/js.translator/testFiles/tuple/cases/multipleMembers.kt +++ /dev/null @@ -1,15 +0,0 @@ -package foo - -fun box() : Boolean { - if (#(1, 2, 3)._1 != 1) return false; - if (#("a", "b")._2 != "b") return false; - val x = #("1", 2, "3", 4, "5", 6); - if (x._1 != "1") return false; - if (x._2 != 2) return false; - if (x._2 != 2) return false; - if (x._6 != 6) return false; - if (x._5 != "5") return false; - if (x._3 != "3") return false; - if (#(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)._21 != 1) return false; - return true; -} \ No newline at end of file diff --git a/js/js.translator/testFiles/tuple/cases/tuplesEquals.kt b/js/js.translator/testFiles/tuple/cases/tuplesEquals.kt deleted file mode 100644 index 8768ee0e43c..00000000000 --- a/js/js.translator/testFiles/tuple/cases/tuplesEquals.kt +++ /dev/null @@ -1,31 +0,0 @@ -package foo - -class A(val i: Int = 2) { - fun equals(other: Any?): Boolean { - if (other !is A) { - return false - } - return i % 2 == other.i % 2 - } -} - -fun box(): Boolean { - val c = #(3, 1) - if (c != #(3, 1)) { - return false - } - if (c == #(1, 3)) { - return false - } - val b = #(A(2), A(1)) - if (b != #(A(0), A(3))) { - return false - } - if (b == #(A(2), A(4))) { - return false - } - if (#("aaa") != #("aaa")) { - return false - } - return true -} diff --git a/js/js.translator/testFiles/tuple/cases/twoElements.kt b/js/js.translator/testFiles/tuple/cases/twoElements.kt deleted file mode 100644 index d0ab07e1916..00000000000 --- a/js/js.translator/testFiles/tuple/cases/twoElements.kt +++ /dev/null @@ -1,6 +0,0 @@ -package foo - -fun box() : Boolean { - val a : #(Int, Int) = #(1, 2) - return ((a._1 == 1) && (a._2 == 2)) - } \ No newline at end of file diff --git a/js/js.translator/testFiles/webDemoCanvasExamples/cases/Creatures.kt b/js/js.translator/testFiles/webDemoCanvasExamples/cases/Creatures.kt index 4984ead30df..d61088a405d 100644 --- a/js/js.translator/testFiles/webDemoCanvasExamples/cases/Creatures.kt +++ b/js/js.translator/testFiles/webDemoCanvasExamples/cases/Creatures.kt @@ -156,7 +156,7 @@ class Creature(override var pos: Vector, val state: CanvasState): Shape() { val gradientCentre = position + directionToLogo * (radius / 4) val gradient = context.createRadialGradient(gradientCentre.x, gradientCentre.y, 1.0, gradientCentre.x, gradientCentre.y, 2 * radius)!! for (colorStop in colorStops) { - gradient.addColorStop(colorStop._1, colorStop._2) + gradient.addColorStop(colorStop.first, colorStop.second) } return gradient } @@ -287,23 +287,23 @@ class CanvasState(val canvas: HTMLCanvasElement) { } class RadialGradientGenerator(val context: CanvasContext) { - val gradients = ArrayList>() + val gradients = ArrayList>>() var current = 0 - fun newColorStops(vararg colorStops: #(Double, String)) { + fun newColorStops(vararg colorStops: Pair) { gradients.add(colorStops) } { - newColorStops(#(0.0, "#F59898"), #(0.5, "#F57373"), #(1.0, "#DB6B6B")) - newColorStops(#(0.39, "rgb(140,167,209)"), #(0.7, "rgb(104,139,209)"), #(0.85, "rgb(67,122,217)")) - newColorStops(#(0.0, "rgb(255,222,255)"), #(0.5, "rgb(255,185,222)"), #(1.0, "rgb(230,154,185)")) - newColorStops(#(0.0, "rgb(255,209,114)"), #(0.5, "rgb(255,174,81)"), #(1.0, "rgb(241,145,54)")) - newColorStops(#(0.0, "rgb(132,240,135)"), #(0.5, "rgb(91,240,96)"), #(1.0, "rgb(27,245,41)")) - newColorStops(#(0.0, "rgb(250,147,250)"), #(0.5, "rgb(255,80,255)"), #(1.0, "rgb(250,0,217)")) + newColorStops(Pair(0.0, "#F59898"), Pair(0.5, "#F57373"), Pair(1.0, "#DB6B6B")) + newColorStops(Pair(0.39, "rgb(140,167,209)"), Pair(0.7, "rgb(104,139,209)"), Pair(0.85, "rgb(67,122,217)")) + newColorStops(Pair(0.0, "rgb(255,222,255)"), Pair(0.5, "rgb(255,185,222)"), Pair(1.0, "rgb(230,154,185)")) + newColorStops(Pair(0.0, "rgb(255,209,114)"), Pair(0.5, "rgb(255,174,81)"), Pair(1.0, "rgb(241,145,54)")) + newColorStops(Pair(0.0, "rgb(132,240,135)"), Pair(0.5, "rgb(91,240,96)"), Pair(1.0, "rgb(27,245,41)")) + newColorStops(Pair(0.0, "rgb(250,147,250)"), Pair(0.5, "rgb(255,80,255)"), Pair(1.0, "rgb(250,0,217)")) } - fun getNext(): Array<#(Double, String)> { + fun getNext(): Array> { val result = gradients.get(current) current = (current + 1) % gradients.size() return result diff --git a/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/highlighter2/Html2CompilerPlugin.kt b/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/highlighter2/Html2CompilerPlugin.kt index b327b9930fe..10edfe8449f 100644 --- a/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/highlighter2/Html2CompilerPlugin.kt +++ b/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/highlighter2/Html2CompilerPlugin.kt @@ -54,7 +54,7 @@ class Html2CompilerPlugin(private val compilerArguments: KDocArguments) : Doclet File(srcOutputRoot, "highlight.css").write { outputStream -> css.copyTo(outputStream) - #() + Unit.VALUE } for (sourceInfo in model.sourcesInfo) {