[FIR-TEST] Add new testdata generated after changes in previous commit

This commit is contained in:
Dmitriy Novozhilov
2019-12-11 16:16:22 +03:00
parent e9c02a1cca
commit 2536fa0cd5
4578 changed files with 104067 additions and 1 deletions
@@ -0,0 +1,31 @@
// !WITH_NEW_INFERENCE
// !LANGUAGE: +ArrayLiteralsInAnnotations
annotation class Foo(val a: IntArray, val b: Array<String>, val c: FloatArray)
@Foo([1], ["/"], [1f])
fun test1() {}
@Foo([], [], [])
fun test2() {}
@Foo([1f], [' '], [1])
fun test3() {}
@Foo(c = [1f], b = [""], a = [1])
fun test4() {}
@Foo([1 + 2], ["Hello, " + "Kotlin"], [1 / 0f])
fun test5() {}
const val ONE = 1
val two = 2
@Foo([ONE], [], [])
fun test6() {}
@Foo([ONE + two], [], [])
fun test7() {}
@Foo([two], [], [])
fun test8() {}
@@ -0,0 +1,31 @@
// !WITH_NEW_INFERENCE
// !LANGUAGE: +ArrayLiteralsInAnnotations
import kotlin.reflect.KClass
annotation class Foo(val a: Array<KClass<*>> = [])
class Gen<T>
annotation class Bar(val a: Array<KClass<*>> = [Int::class, Array<Int>::class, Gen::class])
@Foo([])
fun test1() {}
@Foo([Int::class, String::class])
fun test2() {}
@Foo([Array::class])
fun test3() {}
@Foo([Gen<Int>::class])
fun test4() {}
@Foo([""])
fun test5() {}
@Foo([Int::class, 1])
fun test6() {}
@Bar
fun test7() {}
@@ -0,0 +1,24 @@
// !WITH_NEW_INFERENCE
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNSUPPORTED
fun test() {
val a = []
val b: Array<Int> = []
val c = [1, 2]
val d: Array<Int> = [1, 2]
val e: Array<String> = [1]
val f: IntArray = [1, 2]
val g = [f]
}
fun check() {
[1, 2] checkType { <!UNRESOLVED_REFERENCE!>_<!><Array<Int>>() }
[""] checkType { <!UNRESOLVED_REFERENCE!>_<!><Array<String>>() }
val f: IntArray = [1]
[f] checkType { <!UNRESOLVED_REFERENCE!>_<!><Array<IntArray>>() }
[1, ""] checkType { <!UNRESOLVED_REFERENCE!>_<!><Array<Any>>() }
}
@@ -0,0 +1,18 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNSUPPORTED
fun basicTypes() {
val a: IntArray = [1]
val b: ByteArray = [1]
val c: BooleanArray = [true, false]
val d: CharArray = ['a']
val e: ShortArray = [1]
val f: FloatArray = [1.0f]
val g: LongArray = [1]
val h: DoubleArray = [1.0]
}
fun basicTypesWithErrors() {
val a: IntArray = [1.0]
val b: ShortArray = [1.0]
val c: CharArray = ["a"]
}
@@ -0,0 +1,22 @@
// !LANGUAGE: +NewInference
// !WITH_NEW_INFERENCE
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
fun takeArray(array: Array<String>) {}
fun test() {
"foo bar".<!UNRESOLVED_REFERENCE!>split<!>([""])
<!UNRESOLVED_REFERENCE!>unresolved<!>([""])
takeArray([""])
val v = [""]
[""]
[1, 2, 3].<!UNRESOLVED_REFERENCE!>size<!>
}
fun baz(arg: Array<Int> = []) {
if (true) ["yes"] else {["no"]}
}
class Foo(
val v: Array<Int> = []
)
@@ -0,0 +1,41 @@
// !WITH_NEW_INFERENCE
// !LANGUAGE: +ArrayLiteralsInAnnotations, +ProhibitAssigningSingleElementsToVarargsInNamedForm
annotation class Ann1(vararg val a: String = [])
annotation class Ann2(vararg val a: Int = [1, 2])
annotation class Ann3(vararg val a: Float = [1f])
annotation class Ann4(vararg val a: String = ["/"])
annotation class Ann5(vararg val a: Ann4 = [])
annotation class Ann6(vararg val a: Ann4 = [Ann4(*["a", "b"])])
annotation class Ann7(vararg val a: Long = [1L, null, ""])
@Ann1(*[])
fun test1_0() {}
@Ann1(*["a", "b"])
fun test1_1() {}
@Ann1(*["a", 1, null])
fun test1_2() {}
@Ann2(*[])
fun test2() {}
@Ann3(a = *[0f, 1 / 0f])
fun test3() {}
@Ann5(Ann4(*["/"]))
fun test5() {}
@Ann6(*[])
fun test6() {}
annotation class AnnArray(val a: Array<String>)
@AnnArray(*["/"])
fun testArray() {}
@Ann1([""])
fun testVararg() {}
@@ -0,0 +1,26 @@
// !WITH_NEW_INFERENCE
// !LANGUAGE: +ArrayLiteralsInAnnotations
annotation class Foo(
val a: Array<String> = ["/"],
val b: Array<String> = [],
val c: Array<String> = ["1", "2"]
)
annotation class Bar(
val a: Array<String> = [' '],
val b: Array<String> = ["", <!INFERENCE_ERROR!>''<!>],
val c: Array<String> = [1]
)
annotation class Base(
val a0: IntArray = [],
val a1: IntArray = [1],
val b1: FloatArray = [1f],
val b0: FloatArray = []
)
annotation class Err(
val a: IntArray = [1L],
val b: Array<String> = [1]
)
@@ -0,0 +1,25 @@
// !LANGUAGE: +ArrayLiteralsInAnnotations
const val ONE = 1
annotation class Foo(
val a: IntArray = [ONE],
val b: IntArray = [ONE, 2, 3]
)
val TWO = 2
fun getOne() = ONE
fun getTwo() = TWO
annotation class Bar(
val a: IntArray = [TWO],
val b: IntArray = [1, TWO],
val c: IntArray = [getOne(), getTwo()]
)
annotation class Baz(
val a: IntArray = [null],
val b: IntArray = [1, null, 2],
val c: IntArray = [this]
)
@@ -0,0 +1,19 @@
// !LANGUAGE: -ArrayLiteralsInAnnotations
annotation class Foo(
val a: IntArray = [],
val b: FloatArray = [1f, 2f],
val c: Array<String> = ["/"]
)
@Foo
fun test1() {}
@Foo(a = [1, 2], c = ["a"])
fun test2() {}
@Foo([1], [3f], ["a"])
fun test3() {}
fun test4() {
[1, 2]
}
@@ -0,0 +1,16 @@
// !WITH_NEW_INFERENCE
fun test(): Array<Int> {
[1, 2]
<!UNRESOLVED_REFERENCE!>[1, 2][0]<!>
[1, 2].<!UNRESOLVED_REFERENCE!>get<!>(0)
foo([""])
val p = [1, 2] + [3, 4]
return [1, 2]
}
fun foo(a: Array<String> = [""]) {}
class A(val a: Array<Int> = [])
@@ -0,0 +1,18 @@
// !LANGUAGE: +ArrayLiteralsInAnnotations
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNSUPPORTED
annotation class Anno(val a: Array<String> = [""], val b: IntArray = [])
@Anno([], [])
fun test() {}
fun arrayOf(): Array<Int> = TODO()
fun intArrayOf(): Array<Int> = TODO()
fun local() {
val a1: IntArray = [1, 2]
val a2: IntArray = []
val s1: Array<String> = [""]
val s2: Array<String> = []
}