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
+3 -1
View File
@@ -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>>
+1 -1
View File
@@ -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 -1
View File
@@ -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
+8 -8
View File
@@ -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 {
+4 -2
View File
@@ -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() {
+1 -3
View File
@@ -42,6 +42,4 @@ fun test() {
when (z) {
else -> 1
}
}
val #(Int, Int).boo : #(Int, Int, Int) = #(1, 1, 1)
}
+3 -24
View File
@@ -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 */
+5 -3
View File
@@ -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 -1
View File
@@ -1,2 +1,2 @@
var x : <ref>Unit?
//jet.src/Tuples.jet:Tuple0
//jet.src/Unit.jet:Tuple0