Front-end test data fixed to have no complex patterns

#KT-2359 In Progress
This commit is contained in:
Andrey Breslav
2012-09-05 13:03:14 +04:00
parent 1b65ba644e
commit a267f65fa1
8 changed files with 55 additions and 144 deletions
+5 -25
View File
@@ -12,17 +12,9 @@ fun foo() : Int {
1 + <error>a</error> -> 1
in 1..<error>a</error> -> 1
!in 1..<error>a</error> -> 1
// Commented for KT-621 .<!error>a</!error> -> 1
// Commented for KT-621 .equals(1).<!error>a</!error> -> 1
// Commented for KT-621 <!warning>?.</!warning>equals(1) -> 1
is * -> 1
else -> 1
}
// Commented for KT-621
// return when (<!warning>x</!warning>?:null) {
// <!error>.</!error>foo() -> 1
// ?.equals(1).equals(2) -> 1
// }
return 0
}
@@ -34,29 +26,17 @@ fun test() {
when (x) {
<error>s</error> -> 1
is <error>""</error> -> 1
<error>""</error> -> 1
x -> 1
is 1 -> 1
is <error>#(1, 1)</error> -> 1
1 -> 1
else -> 1
}
val z = #(1, 1)
when (z) {
is #(*, *) -> 1
is #(*, 1) -> 1
is #(1, 1) -> 1
is #(1, <error>"1"</error>) -> 1
is <error>#(1, "1", *)</error> -> 1
is boo #(1, <error>"a"</error>, *) -> 1
is boo <error>#(1, *)</error> -> 1
else -> 1
}
val z = 1
when (z) {
<error>else</error> -> 1
<error>#(1, 1) -> 2</error>
<error>1 -> 2</error>
}
when (z) {
+15 -33
View File
@@ -66,27 +66,22 @@ fun f12(a : A?) {
is A -> <info descr="Automatically cast to A">a</info>.foo()
is Any -> <info descr="Automatically cast to A">a</info>.foo();
is Any? -> a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
is val c : <error descr="[TYPE_MISMATCH_IN_BINDING_PATTERN] B is not a supertype of A?. Use 'is' to match against B">B</error> -> c.foo()
is val c is C -> <info descr="Automatically cast to C">c</info>.bar()
is val c is C -> <info descr="Automatically cast to C">a</info>.bar()
is C -> <info descr="Automatically cast to C">a</info>.bar()
else -> a<info>?.</info>foo()
}
if (a is val b) {
if (a is Any?) {
a<info>?.</info><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
b<info>?.</info>foo()
}
if (a is val b is B) {
<info descr="Automatically cast to B">b</info>.foo()
if (a is B) {
<info descr="Automatically cast to B">a</info>.bar()
<info descr="Automatically cast to B">b</info>.bar()
}
}
fun f13(a : A?) {
if (a is val c is B) {
<info descr="Automatically cast to B">c</info>.foo()
<info descr="Automatically cast to B">c</info>.bar()
if (a is B) {
<info descr="Automatically cast to B">a</info>.foo()
<info descr="Automatically cast to B">a</info>.bar()
}
else {
a<info>?.</info>foo()
@@ -94,54 +89,43 @@ fun f13(a : A?) {
}
a<info>?.</info>foo()
if (!(a is val c is B)) {
if (!(a is B)) {
a<info>?.</info>foo()
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.bar()
}
else {
<info descr="Automatically cast to B">a</info>.foo()
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.bar()
}
a<info>?.</info>foo()
if (a is val c is B && <info descr="Automatically cast to B">a</info>.foo() == #() && <info descr="Automatically cast to B">c</info>.bar() == #()) {
<info descr="Automatically cast to B">c</info>.foo()
<info descr="Automatically cast to B">c</info>.bar()
if (a is B && <info descr="Automatically cast to B">a</info>.foo() == #()) {
<info descr="Automatically cast to B">a</info>.foo()
<info descr="Automatically cast to B">a</info>.bar()
}
else {
a<info>?.</info>foo()
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.bar()
}
if (!(a is val c is B) || !(a is val x is C)) {
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: x">x</error>
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>
if (!(a is B) || !(a is C)) {
}
else {
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: x">x</error>
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>
}
if (!(a is val c is B) || !(a is val c is C)) {
if (!(a is B) || !(a is C)) {
}
if (!(a is val c is B)) return
if (!(a is B)) return
<info descr="Automatically cast to B">a</info>.bar()
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.foo()
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.bar()
}
fun f14(a : A?) {
while (!(a is val c is B)) {
while (!(a is B)) {
}
<info descr="Automatically cast to B">a</info>.bar()
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.bar()
}
fun f15(a : A?) {
do {
} while (!(a is val c is B))
} while (!(a is B))
<info descr="Automatically cast to B">a</info>.bar()
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.bar()
}
fun getStringLength(obj : Any) : Char? {
@@ -213,8 +197,6 @@ fun returnFunctionLiteral(<info>a</info>: Any?): Function0<Int> =
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 declarationInsidePattern(x: #(Any, Any)): String = when(x) { is #(val a is String, *) -> <info descr="Automatically cast to jet.String">a</info>; else -> "something" }
fun mergeAutocasts(a: Any?) {
if (a is String || a is Int) {
a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: compareTo">compareTo</error>("")