Removing usages of tuples from test data

(KT-2358 Drop tuples)
 #KT-2358 In progress
This commit is contained in:
Andrey Breslav
2012-09-18 13:48:20 +04:00
parent dee5152f9b
commit 5eaa5b396b
64 changed files with 172 additions and 330 deletions
@@ -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<!>>
+1 -1
View File
@@ -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 {
+1 -1
View File
@@ -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() {
+1 -3
View File
@@ -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
}