Removing usages of tuples from test data
(KT-2358 Drop tuples) #KT-2358 In progress
This commit is contained in:
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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()}"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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<String, Any?>?) {
|
||||
fun toHasMap(value: Any?): Pair<Boolean, HashMap<String, Any?>?> {
|
||||
if(value is HashMap<*, *>) {
|
||||
return #(true, value as HashMap<String, Any?>)
|
||||
return Pair(true, value as HashMap<String, Any?>)
|
||||
}
|
||||
return #(false, null as HashMap<String, Any?>?)
|
||||
return Pair(false, null as HashMap<String, Any?>?)
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
fun main(args: Array<String>?) {
|
||||
val y: Unit = #() //do not compile
|
||||
val y: Unit = Unit.VALUE //do not compile
|
||||
A<Unit>() //do not compile
|
||||
C<Unit>(#()) //do not compile
|
||||
C<Unit>(Unit.VALUE) //do not compile
|
||||
//do not compile
|
||||
System.out?.println(fff<Unit>(#())) //do not compile
|
||||
System.out?.println(fff<Unit>(Unit.VALUE)) //do not compile
|
||||
System.out?.println(id<Unit>(y)) //do not compile
|
||||
System.out?.println(fff<Unit>(id<Unit>(y)) == id<Unit>(foreach(Array<Int>(0,{0}),{(e : Int) : Unit -> }))) //do not compile
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
@@ -18,7 +18,9 @@ package boundsWithSubstitutors
|
||||
open class A {}
|
||||
open class B<T : A>()
|
||||
|
||||
abstract class C<T : B<<!UPPER_BOUND_VIOLATED!>Int<!>>, X : (B<<!UPPER_BOUND_VIOLATED!>Char<!>>) -> #(B<<!UPPER_BOUND_VIOLATED!>Any<!>>, B<A>)>() : B<<!UPPER_BOUND_VIOLATED, UPPER_BOUND_VIOLATED!>Any<!>>() { // 2 errors
|
||||
class Pair<A, B>
|
||||
|
||||
abstract class C<T : B<<!UPPER_BOUND_VIOLATED!>Int<!>>, X : (B<<!UPPER_BOUND_VIOLATED!>Char<!>>) -> Pair<B<<!UPPER_BOUND_VIOLATED!>Any<!>>, B<A>>>() : B<<!UPPER_BOUND_VIOLATED, UPPER_BOUND_VIOLATED!>Any<!>>() { // 2 errors
|
||||
val a = B<<!UPPER_BOUND_VIOLATED!>Char<!>>() // error
|
||||
|
||||
abstract val x : (B<<!UPPER_BOUND_VIOLATED!>Char<!>>) -> B<<!UPPER_BOUND_VIOLATED!>Any<!>>
|
||||
|
||||
@@ -12,5 +12,5 @@ fun test() : Unit {
|
||||
y <!USELESS_CAST!>as?<!> Int : Int?
|
||||
x <!USELESS_CAST!>as?<!> Int? : Int?
|
||||
y <!USELESS_CAST_STATIC_ASSERT_IS_FINE!>as?<!> Int? : Int?
|
||||
#()
|
||||
Unit.VALUE
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ fun unitEmptyInfer() {}
|
||||
fun unitEmpty() : Unit {}
|
||||
fun unitEmptyReturn() : Unit {return}
|
||||
fun unitIntReturn() : Unit {return <!TYPE_MISMATCH!>1<!>}
|
||||
fun unitUnitReturn() : Unit {return #()}
|
||||
fun unitUnitReturn() : Unit {return Unit.VALUE}
|
||||
fun test1() : Any = {<!RETURN_NOT_ALLOWED, RETURN_TYPE_MISMATCH!>return<!>}
|
||||
fun test2() : Any = @a {return@a 1}
|
||||
fun test3() : Any { <!RETURN_TYPE_MISMATCH!>return<!> }
|
||||
@@ -25,7 +25,7 @@ fun foo(<!UNUSED_PARAMETER!>expr<!>: StringBuilder): Int {
|
||||
}
|
||||
|
||||
|
||||
fun unitShort() : Unit = #()
|
||||
fun unitShort() : Unit = Unit.VALUE
|
||||
fun unitShortConv() : Unit = <!TYPE_MISMATCH!>1<!>
|
||||
fun unitShortNull() : Unit = <!TYPE_MISMATCH!>null<!>
|
||||
|
||||
@@ -42,7 +42,7 @@ fun intFunctionLiteral(): Int = <!TYPE_MISMATCH!>{ 10 }<!>
|
||||
fun blockReturnUnitMismatch() : Int {<!RETURN_TYPE_MISMATCH!>return<!>}
|
||||
fun blockReturnValueTypeMismatch() : Int {return <!ERROR_COMPILE_TIME_VALUE!>3.4<!>}
|
||||
fun blockReturnValueTypeMatch() : Int {return 1}
|
||||
fun blockReturnValueTypeMismatchUnit() : Int {return <!TYPE_MISMATCH!>#()<!>}
|
||||
fun blockReturnValueTypeMismatchUnit() : Int {return <!TYPE_MISMATCH!>Unit.VALUE<!>}
|
||||
|
||||
fun blockAndAndMismatch() : Int {
|
||||
true && false
|
||||
|
||||
@@ -36,9 +36,12 @@ class D() {
|
||||
}
|
||||
}
|
||||
|
||||
fun foo(): Unit {}
|
||||
|
||||
fun cannotBe(var <!UNUSED_PARAMETER!>i<!>: Int) {
|
||||
<!UNRESOLVED_REFERENCE!>z<!> = 30;
|
||||
<!VARIABLE_EXPECTED!>#()<!> = #();
|
||||
<!VARIABLE_EXPECTED!>""<!> = "";
|
||||
<!VARIABLE_EXPECTED!>foo()<!> = Unit.VALUE;
|
||||
|
||||
(<!VARIABLE_EXPECTED!>i <!USELESS_CAST!>as<!> Int<!>) = 34
|
||||
(<!VARIABLE_EXPECTED!>i is Int<!>) = false
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -34,7 +34,7 @@ class A<E>() : C(), T {
|
||||
super<<!NOT_A_SUPERTYPE!>Int<!>>.foo()
|
||||
super<<!SYNTAX!><!>>.foo()
|
||||
super<<!NOT_A_SUPERTYPE!>() -> Unit<!>>.foo()
|
||||
super<<!NOT_A_SUPERTYPE!>#()<!>>.foo()
|
||||
super<<!NOT_A_SUPERTYPE!>Unit<!>>.foo()
|
||||
super<T><!UNRESOLVED_REFERENCE!>@B<!>.foo()
|
||||
super<C><!UNRESOLVED_REFERENCE!>@B<!>.bar()
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package unresolved
|
||||
|
||||
class Pair<A, B>(val a: A, val b: B)
|
||||
|
||||
fun testGenericArgumentsCount() {
|
||||
val <!UNUSED_VARIABLE!>p1<!>: Tuple2<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!> = #(2, 2)
|
||||
val <!UNUSED_VARIABLE!>p2<!>: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Tuple2<!> = #(2, 2)
|
||||
val <!UNUSED_VARIABLE!>p1<!>: Pair<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!> = Pair(2, 2)
|
||||
val <!UNUSED_VARIABLE!>p2<!>: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Pair<!> = Pair(2, 2)
|
||||
}
|
||||
|
||||
fun testUnresolved() {
|
||||
|
||||
@@ -41,6 +41,4 @@ fun test() {
|
||||
when (z) {
|
||||
else -> 1
|
||||
}
|
||||
}
|
||||
|
||||
val #(Int, Int).boo : #(Int, Int, Int) = #(1, 1, 1)
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
//KT-657 Semantic checks for when without condition
|
||||
package kt657
|
||||
|
||||
class Pair<A, B>(a: A, b: B)
|
||||
|
||||
fun foo() =
|
||||
when {
|
||||
cond1() -> 12
|
||||
cond2() -> 2
|
||||
<!TYPE_MISMATCH_IN_CONDITION!>4<!> -> 34
|
||||
<!TYPE_MISMATCH_IN_CONDITION!>#(1, 2)<!> -> 3
|
||||
<!TYPE_MISMATCH_IN_CONDITION!>Pair(1, 2)<!> -> 3
|
||||
<!EXPECTED_CONDITION!>in 1..10<!> -> 34
|
||||
<!TYPE_MISMATCH_IN_CONDITION!>4<!> -> 38
|
||||
<!EXPECTED_CONDITION!>is Int<!> -> 33
|
||||
|
||||
@@ -3,17 +3,18 @@
|
||||
|
||||
package kt234_kt973
|
||||
|
||||
class Pair<A, B>(a: A, b: B)
|
||||
|
||||
fun test(t : #(Int, Int)) : Int {
|
||||
fun test(t : Pair<Int, Int>) : Int {
|
||||
<!NO_ELSE_IN_WHEN!>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, Int>) : Int {
|
||||
when (t) {
|
||||
#(10, 10) -> return 1
|
||||
Pair(10, 10) -> return 1
|
||||
else -> return 2
|
||||
}
|
||||
<!UNREACHABLE_CODE!>return 0<!> // unreachable code
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
class C(val f : Int)
|
||||
|
||||
fun test(e : Any) {
|
||||
if (e is C) {
|
||||
#(e.f)
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
package outer
|
||||
|
||||
fun Int?.optint() : Unit {}
|
||||
val Int?.optval : Unit = #()
|
||||
val Int?.optval : Unit = Unit.VALUE
|
||||
|
||||
fun <T, E> T.foo(<!UNUSED_PARAMETER!>x<!> : E, y : A) : T {
|
||||
y.plus(1)
|
||||
|
||||
@@ -20,7 +20,7 @@ fun f9(init : A?) {
|
||||
a?.<!UNRESOLVED_REFERENCE!>bar<!>()
|
||||
a?.foo()
|
||||
}
|
||||
if (!(a is B) || a.bar() == #()) {
|
||||
if (!(a is B) || a.bar() == Unit.VALUE) {
|
||||
a?.<!UNRESOLVED_REFERENCE!>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 <!UNUSED_VARIABLE!>p4<!>: #(Int, String) = #(2, a)
|
||||
val <!UNUSED_VARIABLE!>p4<!>: String = a
|
||||
}
|
||||
if (a is String?) {
|
||||
if (a != null) {
|
||||
@@ -172,25 +172,6 @@ fun vars(a: Any?) {
|
||||
b = <!UNUSED_VALUE!>a<!>
|
||||
}
|
||||
}
|
||||
fun tuples(a: Any?) {
|
||||
if (a != null) {
|
||||
val <!UNUSED_VARIABLE!>s<!>: #(Any, String) = #(a, <!TYPE_MISMATCH!>a<!>)
|
||||
}
|
||||
if (a is String) {
|
||||
val <!UNUSED_VARIABLE!>s<!>: #(Any, String) = #(a, a)
|
||||
}
|
||||
fun illegalTupleReturnType(): #(Any, String) = #(<!TYPE_MISMATCH!>a<!>, <!TYPE_MISMATCH!>a<!>)
|
||||
if (a is String) {
|
||||
fun legalTupleReturnType(): #(Any, String) = #(a, a)
|
||||
}
|
||||
val <!UNUSED_VARIABLE!>illegalFunctionLiteral<!>: Function0<Int> = <!TYPE_MISMATCH!>{ <!TYPE_MISMATCH!>a<!> }<!>
|
||||
val <!UNUSED_VARIABLE!>illegalReturnValueInFunctionLiteral<!>: Function0<Int> = { (): Int -> <!TYPE_MISMATCH!>a<!> }
|
||||
|
||||
if (a is Int) {
|
||||
val <!UNUSED_VARIABLE!>legalFunctionLiteral<!>: Function0<Int> = { a }
|
||||
val <!UNUSED_VARIABLE!>alsoLegalFunctionLiteral<!>: Function0<Int> = { (): Int -> a }
|
||||
}
|
||||
}
|
||||
fun returnFunctionLiteralBlock(a: Any?): Function0<Int> {
|
||||
if (a is Int) return { a }
|
||||
else return { 1 }
|
||||
@@ -199,8 +180,6 @@ fun returnFunctionLiteral(a: Any?): Function0<Int> =
|
||||
if (a is Int) { (): Int -> a }
|
||||
else { () -> 1 }
|
||||
|
||||
fun illegalTupleReturnType(a: Any): #(Any, String) = #(a, <!TYPE_MISMATCH!>a<!>)
|
||||
|
||||
fun mergeAutocasts(a: Any?) {
|
||||
if (a is String || a is Int) {
|
||||
a.<!UNRESOLVED_REFERENCE!>compareTo<!>("")
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -2,11 +2,13 @@ package a
|
||||
|
||||
//KT-2234 'period!!' has type Int?
|
||||
|
||||
class Pair<A, B>(val a: A, val b: B)
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
val d : Long = 1
|
||||
val period : Int? = null
|
||||
if (period != null) #(d, period<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!> : Int) else #(d, 1)
|
||||
if (period != null) #(d, period : Int) else #(d, 1)
|
||||
if (period != null) Pair(d, period<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!> : Int) else Pair(d, 1)
|
||||
if (period != null) Pair(d, period : Int) else Pair(d, 1)
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
|
||||
@@ -4,12 +4,12 @@ trait Bar
|
||||
trait A {
|
||||
fun <T> foo()
|
||||
where T : Foo, T : Bar
|
||||
= #()
|
||||
= Unit.VALUE
|
||||
}
|
||||
|
||||
class B : A {
|
||||
override fun <T> foo()
|
||||
where T : Foo, T : Bar
|
||||
= #()
|
||||
= Unit.VALUE
|
||||
|
||||
}
|
||||
@@ -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 <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>MyIllegalClass<!> : MyTrait, MyAbstract
|
||||
|
||||
class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>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 <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>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 <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>MyIllegalClass4<!>() : MyTrait, MyAbstractClass() {
|
||||
@@ -44,7 +44,7 @@ class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>MyIllegalClass4<!>() : MyTrait, MyAbstr
|
||||
|
||||
class MyChildClass1() : MyClass() {
|
||||
<!VIRTUAL_MEMBER_HIDDEN!>fun foo()<!> {}
|
||||
<!VIRTUAL_MEMBER_HIDDEN!>val pr : Unit<!> = #()
|
||||
<!VIRTUAL_MEMBER_HIDDEN!>val pr : Unit<!> = Unit.VALUE
|
||||
override fun bar() {}
|
||||
override val prr : Unit = #()
|
||||
override val prr : Unit = Unit.VALUE
|
||||
}
|
||||
@@ -20,7 +20,7 @@ fun foo(a: A) {
|
||||
a.gen() // unit can be inferred
|
||||
}
|
||||
else {
|
||||
#()
|
||||
Unit.VALUE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
class MyListOfPairs<T> : ArrayList<#(T, T)>() { }
|
||||
class Pair<A, B>(val a: A, val b: B)
|
||||
|
||||
class MyListOfPairs<T> : ArrayList<Pair<T, T>>() { }
|
||||
|
||||
fun test() {
|
||||
MyListOfPairs<Int>() : ArrayList<#(Int, Int)>
|
||||
MyListOfPairs<Int>() : ArrayList<Pair<Int, Int>>
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
fun foo(a : #(Int, String)) {
|
||||
a._1 : Int
|
||||
a._2 : String
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
package test
|
||||
|
||||
public open class MethodTypePOneUpperBound() : java.lang.Object() {
|
||||
public open fun <T : Cloneable?> bar() : Unit = #()
|
||||
public open fun <T : Cloneable?> bar() : Unit = Unit.VALUE
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package test
|
||||
|
||||
public class MethodWithTypeP() : java.lang.Object() {
|
||||
public fun <P> f() : Unit = #()
|
||||
public fun <P> f() : Unit = Unit.VALUE
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package test
|
||||
|
||||
public class MethodWithTypePP() : java.lang.Object() {
|
||||
public fun <P, Q : P> f() : Unit = #()
|
||||
public fun <P, Q : P> f() : Unit = Unit.VALUE
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package test
|
||||
|
||||
public open class MethodWithTypePRefClassP<P>() : java.lang.Object() {
|
||||
public fun <Q : P> f() : Unit = #()
|
||||
public fun <Q : P> f() : Unit = Unit.VALUE
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package test
|
||||
|
||||
public final class MethosWithPRefTP() : java.lang.Object() {
|
||||
public fun <P> f(p0: P?) : Unit = #()
|
||||
public fun <P> f(p0: P?) : Unit = Unit.VALUE
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -5,4 +5,4 @@ trait Bar
|
||||
|
||||
fun <T> foo()
|
||||
where T : Foo, T : Bar
|
||||
= #()
|
||||
= Unit.VALUE
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package test
|
||||
|
||||
fun tuple0() = #()
|
||||
fun tuple0() = Unit.VALUE
|
||||
|
||||
@@ -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<Int, String>
|
||||
var v10 : Tuple3<Int, Int, Int>?
|
||||
|
||||
//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
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
@@ -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,D> E.foo(extra: java.util.List<D>) = #(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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
open class A {}
|
||||
open class B<T : A>()
|
||||
|
||||
abstract class C<T : B<<error>Int</error>>, X : (B<<error>Char</error>>) -> #(B<<error>Any</error>>, B<A>)>() : B<<error>Any</error>>() { // 2 errors
|
||||
class Pair<A, B>
|
||||
|
||||
abstract class C<T : B<<error>Int</error>>, X : (B<<error>Char</error>>) -> Pair<B<<error>Any</error>>, B<A>>>() : B<<error>Any</error>>() { // 2 errors
|
||||
val a = B<<error>Char</error>>() // error
|
||||
|
||||
abstract val x : (B<<error>Char</error>>) -> B<<error>Any</error>>
|
||||
|
||||
@@ -12,5 +12,5 @@ fun test() : Unit {
|
||||
y <warning>as?</warning> Int : Int?
|
||||
x <warning>as?</warning> Int? : Int?
|
||||
y <warning>as?</warning> Int? : Int?
|
||||
#()
|
||||
Unit.VALUE
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fun Int?.optint() : Unit {}
|
||||
val Int?.optval : Unit = #()
|
||||
val Int?.optval : Unit = Unit.VALUE
|
||||
|
||||
fun <T, E> T.foo(<warning>x</warning> : E, y : A) : T {
|
||||
y.plus(1)
|
||||
|
||||
@@ -4,7 +4,7 @@ fun unitEmptyInfer() {}
|
||||
fun unitEmpty() : Unit {}
|
||||
fun unitEmptyReturn() : Unit {return}
|
||||
fun unitIntReturn() : Unit {return <error>1</error>}
|
||||
fun unitUnitReturn() : Unit {return #()}
|
||||
fun unitUnitReturn() : Unit {return Unit.VALUE}
|
||||
fun test1() : Any = { <error>return</error> }
|
||||
fun test2() : Any = @a {return@a 1}
|
||||
fun test3() : Any { <error>return</error> }
|
||||
@@ -22,7 +22,7 @@ fun foo(<warning>expr</warning>: StringBuilder): Int {
|
||||
}
|
||||
|
||||
|
||||
fun unitShort() : Unit = #()
|
||||
fun unitShort() : Unit = Unit.VALUE
|
||||
fun unitShortConv() : Unit = <error>1</error>
|
||||
fun unitShortNull() : Unit = <error>null</error>
|
||||
|
||||
@@ -39,7 +39,7 @@ fun intFunctionLiteral(): Int = <error>{ 10 }</error>
|
||||
fun blockReturnUnitMismatch() : Int {<error>return</error>}
|
||||
fun blockReturnValueTypeMismatch() : Int {return <error>3.4</error>}
|
||||
fun blockReturnValueTypeMatch() : Int {return 1}
|
||||
fun blockReturnValueTypeMismatchUnit() : Int {return <error>#()</error>}
|
||||
fun blockReturnValueTypeMismatchUnit() : Int {return <error>Unit.VALUE</error>}
|
||||
|
||||
fun blockAndAndMismatch() : Int {
|
||||
true && false
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package unresolved
|
||||
|
||||
class Pair<A, B>(a: A, b: B)
|
||||
|
||||
fun testGenericArgumentsCount() {
|
||||
val <warning>p1</warning>: Tuple2<error><Int></error> = #(2, 2)
|
||||
val <warning>p2</warning>: <error>Tuple2</error> = #(2, 2)
|
||||
val <warning>p1</warning>: Pair<error><Int></error> = Pair(2, 2)
|
||||
val <warning>p2</warning>: <error>Pair</error> = Pair(2, 2)
|
||||
}
|
||||
|
||||
fun testUnresolved() {
|
||||
|
||||
@@ -42,6 +42,4 @@ fun test() {
|
||||
when (z) {
|
||||
else -> 1
|
||||
}
|
||||
}
|
||||
|
||||
val #(Int, Int).boo : #(Int, Int, Int) = #(1, 1, 1)
|
||||
}
|
||||
@@ -19,7 +19,7 @@ fun f9(a : A?) {
|
||||
a<info>?.</info><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
|
||||
a<info>?.</info>foo()
|
||||
}
|
||||
if (!(a is B) || <info descr="Automatically cast to B">a</info>.bar() == #()) {
|
||||
if (!(a is B) || <info descr="Automatically cast to B">a</info>.bar() == Unit.VALUE) {
|
||||
a<info>?.</info><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
|
||||
}
|
||||
if (!(a is B)) {
|
||||
@@ -97,7 +97,7 @@ fun f13(a : A?) {
|
||||
}
|
||||
|
||||
a<info>?.</info>foo()
|
||||
if (a is B && <info descr="Automatically cast to B">a</info>.foo() == #()) {
|
||||
if (a is B && <info descr="Automatically cast to B">a</info>.foo() == Unit.VALUE) {
|
||||
<info descr="Automatically cast to B">a</info>.foo()
|
||||
<info descr="Automatically cast to B">a</info>.bar()
|
||||
}
|
||||
@@ -149,7 +149,7 @@ fun illegalWhenBlock(a: Any): Int {
|
||||
}
|
||||
fun declarations(a: Any?) {
|
||||
if (a is String) {
|
||||
val <warning>p4</warning>: #(Int, String) = #(2, <info descr="Automatically cast to jet.String">a</info>)
|
||||
val <warning>p4</warning>: String = <info descr="Automatically cast to jet.String">a</info>
|
||||
}
|
||||
if (a is String?) {
|
||||
if (a != null) {
|
||||
@@ -168,25 +168,6 @@ fun vars(a: Any?) {
|
||||
b = <info descr="Automatically cast to jet.Int"><warning>a</warning></info>
|
||||
}
|
||||
}
|
||||
fun tuples(<info>a</info>: Any?) {
|
||||
if (<info>a</info> != null) {
|
||||
val <warning>s</warning>: #(Any, String) = #(<info descr="Automatically cast to jet.Any"><info>a</info></info>, <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is jet.Any? but jet.String was expected">a</error>)
|
||||
}
|
||||
if (<info>a</info> is String) {
|
||||
val <warning>s</warning>: #(Any, String) = #(<info descr="Automatically cast to jet.Any"><info>a</info></info>, <info descr="Automatically cast to jet.String"><info>a</info></info>)
|
||||
}
|
||||
fun illegalTupleReturnType(): #(Any, String) = #(<error descr="[TYPE_MISMATCH] Type mismatch: inferred type is jet.Any? but jet.Any was expected">a</error>, <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is jet.Any? but jet.String was expected">a</error>)
|
||||
if (<info>a</info> is String) {
|
||||
fun legalTupleReturnType(): #(Any, String) = #(<info descr="Automatically cast to jet.Any"><info>a</info></info>, <info descr="Automatically cast to jet.String"><info>a</info></info>)
|
||||
}
|
||||
val <warning>illegalFunctionLiteral</warning>: Function0<Int> = <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is () -> jet.Any? but () -> jet.Int was expected">{ <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is jet.Any? but jet.Int was expected">a</error> }</error>
|
||||
val <warning>illegalReturnValueInFunctionLiteral</warning>: Function0<Int> = { (): Int -> <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is jet.Any? but jet.Int was expected">a</error> }
|
||||
|
||||
if (<info>a</info> is Int) {
|
||||
val <warning>legalFunctionLiteral</warning>: Function0<Int> = { <info><info descr="Automatically cast to jet.Int">a</info></info> }
|
||||
val <warning>alsoLegalFunctionLiteral</warning>: Function0<Int> = { (): Int -> <info descr="Automatically cast to jet.Int"><info>a</info></info> }
|
||||
}
|
||||
}
|
||||
fun returnFunctionLiteralBlock(<info>a</info>: Any?): Function0<Int> {
|
||||
if (<info>a</info> is Int) return { <info><info descr="Automatically cast to jet.Int">a</info></info> }
|
||||
else return { 1 }
|
||||
@@ -195,8 +176,6 @@ fun returnFunctionLiteral(<info>a</info>: Any?): Function0<Int> =
|
||||
if (<info>a</info> is Int) { (): Int -> <info descr="Automatically cast to jet.Int"><info>a</info></info> }
|
||||
else { () -> 1 }
|
||||
|
||||
fun illegalTupleReturnType(a: Any): #(Any, String) = #(a, <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is jet.Any but jet.String was expected">a</error>)
|
||||
|
||||
fun mergeAutocasts(a: Any?) {
|
||||
if (a is String || a is Int) {
|
||||
a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: compareTo">compareTo</error>("")
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// "Specify Type Explicitly" "true"
|
||||
val x: Unit = #()
|
||||
val x: Unit = Unit.VALUE
|
||||
@@ -1,2 +1,2 @@
|
||||
// "Specify Type Explicitly" "true"
|
||||
val x <caret>= #()
|
||||
val x <caret>= Unit.VALUE
|
||||
@@ -3,13 +3,13 @@
|
||||
|
||||
package testData.libraries
|
||||
|
||||
[public final val <T : jet.Any?>#(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 <T : jet.Any?>testData.libraries.Pair<T, T>.exProp : jet.String] /* compiled code */
|
||||
|
||||
[public final val globalVal : testData.libraries.Pair<jet.Int, jet.String>] /* compiled code */
|
||||
|
||||
[public final val globalValWithGetter : jet.Long] /* compiled code */
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package testData.libraries
|
||||
|
||||
public class Pair<A, B>(val first: A, val second: B)
|
||||
|
||||
public trait SimpleTrait {
|
||||
}
|
||||
|
||||
@@ -60,7 +62,7 @@ public abstract class ClassWithAbstractAndOpenMembers {
|
||||
public fun main(args : Array<String>) {
|
||||
}
|
||||
|
||||
public val globalVal : #(Int, String) = #(239, "239")
|
||||
public val globalVal : Pair<Int, String> = Pair(239, "239")
|
||||
|
||||
public val globalValWithGetter : Long
|
||||
get() {
|
||||
@@ -77,9 +79,9 @@ get() {
|
||||
return this
|
||||
}
|
||||
|
||||
public val <T> #(T, T).exProp : String
|
||||
public val <T> Pair<T, T>.exProp : String
|
||||
get() {
|
||||
return "${this._1} : ${this._2}"
|
||||
return "${this.first} : ${this.second}"
|
||||
}
|
||||
|
||||
public fun func(a : Int, b : String = "55") {
|
||||
|
||||
@@ -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, T).<2>exProp : String
|
||||
//public val <T> Pair<T, T>.<2>exProp : String
|
||||
@@ -6,6 +6,6 @@ fun foo() {
|
||||
}
|
||||
|
||||
// main.kt
|
||||
//public val <1>globalVal : #(Int, String) = #(239, "239")
|
||||
//public val <1>globalVal : Pair<Int, String> = Pair(239, "239")
|
||||
//
|
||||
//public val <2>globalValWithGetter : Long
|
||||
@@ -1,2 +1,2 @@
|
||||
var x : <ref>Unit?
|
||||
//jet.src/Tuples.jet:Tuple0
|
||||
//jet.src/Unit.jet:Tuple0
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package foo
|
||||
|
||||
fun box() : Boolean {
|
||||
val a : #(Int, Int) = #(1, 2)
|
||||
return ((a._1 == 1) && (a._2 == 2))
|
||||
}
|
||||
@@ -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<Array<#(Double, String)>>()
|
||||
val gradients = ArrayList<Array<Pair<Double, String>>>()
|
||||
var current = 0
|
||||
|
||||
fun newColorStops(vararg colorStops: #(Double, String)) {
|
||||
fun newColorStops(vararg colorStops: Pair<Double, String>) {
|
||||
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<Pair<Double, String>> {
|
||||
val result = gradients.get(current)
|
||||
current = (current + 1) % gradients.size()
|
||||
return result
|
||||
|
||||
+1
-1
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user