[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,11 @@
// !API_VERSION: 1.0
@SinceKotlin("1.1")
annotation class Anno1(val s: String)
annotation class Anno2 @SinceKotlin("1.1") constructor()
@Anno1("")
@Anno2
fun t1() {}
@@ -0,0 +1,23 @@
// !API_VERSION: 1.0
@SinceKotlin("1.1")
open class Foo
class Bar @SinceKotlin("1.1") constructor()
@SinceKotlin("1.0")
class Baz @SinceKotlin("1.1") constructor()
@SinceKotlin("1.1")
class Quux @SinceKotlin("1.0") constructor()
fun t1(): Foo = Foo()
// TODO: do not report API_NOT_AVAILABLE twice
fun t2() = object : Foo() {}
fun t3(): Bar? = Bar()
fun t4(): Baz = Baz()
fun t5(): Quux = Quux()
@@ -0,0 +1,34 @@
// !API_VERSION: 1.0
// FILE: J.java
public interface J {
void foo();
}
// FILE: test.kt
interface I10 {
@SinceKotlin("1.0")
fun foo()
}
interface I11 {
@SinceKotlin("1.1")
fun foo()
}
fun f1(x: I10) = x.foo()
fun f2(x: I11) = x.foo()
fun f3(x: J) = x.foo()
interface BothI1 : I10, I11
fun f4(x: BothI1) = x.foo()
interface BothI2 : I11, I10
fun f5(x: BothI2) = x.foo()
interface JAndI10 : J, I10
fun f6(x: JAndI10) = x.foo()
interface JAndI11 : J, I11
fun f7(x: JAndI11) = x.foo()
@@ -0,0 +1,48 @@
// !API_VERSION: 1.0
val v1: String
@SinceKotlin("1.1")
get() = ""
@SinceKotlin("1.1")
val v2 = ""
var v3: String
@SinceKotlin("1.1")
get() = ""
set(value) {}
var v4: String
get() = ""
@SinceKotlin("1.1")
set(value) {}
var v5: String
@SinceKotlin("1.1")
get() = ""
@SinceKotlin("1.1")
set(value) {}
@SinceKotlin("1.1")
var v6: String
get() = ""
set(value) {}
@SinceKotlin("1.0")
val v7: String
@SinceKotlin("1.1")
get() = ""
fun test() {
v1
v2
v3
v3 = ""
v4
v4 = ""
v5
v5 = ""
v6
v6 = ""
v7
}
@@ -0,0 +1,19 @@
// !API_VERSION: 1.0
@SinceKotlin("1.1")
fun f() {}
@SinceKotlin("1.1")
var p = Unit
@SinceKotlin("1.1.2")
fun z() {}
fun t1() = f()
fun t2() = p
fun t3() { p = Unit }
fun t4() { z() }
@@ -0,0 +1,18 @@
// !API_VERSION: 1.1
@SinceKotlin("0.9")
fun ok1() {}
@SinceKotlin("1.0")
fun ok2() {}
@SinceKotlin("1.1")
fun ok3() {}
@SinceKotlin("0.9.9")
fun ok4() {}
fun t1() = ok1()
fun t2() = ok2()
fun t3() = ok3()
fun t4() = ok4()
@@ -0,0 +1,15 @@
// !API_VERSION: 1.0
class C {
@SinceKotlin("1.1")
companion object {
val x = 42
}
}
typealias CA = C
val test1 = CA
val test2 = CA.<!UNRESOLVED_REFERENCE!>Companion<!>
val test3 = CA.<!UNRESOLVED_REFERENCE!>x<!>
val test4 = CA.<!UNRESOLVED_REFERENCE!>Companion<!>.<!UNRESOLVED_REFERENCE!>x<!>
@@ -0,0 +1,20 @@
// !API_VERSION: 1.0
@SinceKotlin("1.1")
open class C1
typealias C1_Alias = C1
open class C2(val x: Int) {
@SinceKotlin("1.1")
constructor() : this(0)
}
typealias C2_Alias = C2
val test1 = C1_Alias()
val test2 = C2_Alias()
class Test3 : C1_Alias()
class Test4 : C2_Alias()
@@ -0,0 +1,11 @@
// !API_VERSION: 1.0
@SinceKotlin("1.1")
object Since_1_1 {
val x = 42
}
typealias Since_1_1_Alias = Since_1_1
val test1 = Since_1_1_Alias
val test2 = Since_1_1_Alias.<!UNRESOLVED_REFERENCE!>x<!>
@@ -0,0 +1,21 @@
// !API_VERSION: 1.0
@SinceKotlin("1.1")
class Since_1_1
class C
typealias Since_1_1_Alias = Since_1_1
typealias L = List<Since_1_1>
@SinceKotlin("1.1")
typealias C_1_1_Alias = C
fun test1(x: Since_1_1_Alias) = x
fun test2(x: C_1_1_Alias) = x
fun test3(x: List<C_1_1_Alias>) = x
fun test4(x: L) = x
@@ -0,0 +1,18 @@
// !API_VERSION: 1.0
// FILE: a.kt
package a
@SinceKotlin("1.1")
class Since_1_1
typealias Since_1_1_Alias = Since_1_1
@SinceKotlin("1.1")
typealias Alias_1_1 = String
// FILE: b.kt
package b
import a.Since_1_1_Alias
import a.Alias_1_1
@@ -0,0 +1,16 @@
// !DIAGNOSTICS: -NOTHING_TO_INLINE
// !LANGUAGE: -InlineProperties
inline fun String.test() {
}
inline fun test() {
}
class A {
inline fun String.test() {
}
inline fun test() {
}
}
@@ -0,0 +1,20 @@
// !LANGUAGE: -FunctionTypesWithBigArity
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A
fun foo(
p00: A, p01: A, p02: A, p03: A, p04: A, p05: A, p06: A, p07: A, p08: A, p09: A,
p10: A, p11: A, p12: A, p13: A, p14: A, p15: A, p16: A, p17: A, p18: A, p19: A,
p20: A, p21: A, p22: A, p23: A, p24: A, p25: A, p26: A, p27: A, p28: A, p29: A
) {}
fun bar(x: Any) {}
fun test(
w: (A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A) -> Unit,
vararg x: Function30<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, Unit>
) {
bar(::foo)
bar(x)
}
@@ -0,0 +1,25 @@
// !LANGUAGE: -BoundCallableReferences
class C { companion object }
val ok1 = C::hashCode
val fail1 = C.Companion::hashCode
object O {
class Y {
companion object
}
}
val fail2 = O::hashCode
val ok2 = O::Y
val ok3 = O.Y::hashCode
enum class E {
Entry
}
val ok4 = E.Entry::hashCode
fun hashCode() {}
val fail3 = ""::hashCode
val fail4 = (C)::hashCode
val fail5 = (C.Companion)::hashCode
@@ -0,0 +1,18 @@
// !LANGUAGE: -BoundCallableReferences
class C { companion object }
val ok1 = C::class
val ok2 = C.Companion::class
object O
val ok3 = O::class
enum class E {
Entry
}
val ok4 = E.Entry::class
val fail1 = ""::class
val fail2 = String?::class
val fail3 = (C)::class
val fail4 = (C.Companion)::class
@@ -0,0 +1,11 @@
// !LANGUAGE: -BoundCallableReferences
// !DIAGNOSTICS: -UNCHECKED_CAST
import kotlin.reflect.KClass
val <T : Any> KClass<T>.java: Class<T> get() = null!!
val <T : Any> KClass<T>.javaObjectType: Class<T>
get() {
return java.<!UNRESOLVED_REFERENCE!>lang<!>.<!UNRESOLVED_REFERENCE!>Class<!>::class.<!INAPPLICABLE_CANDIDATE!>java<!> as Class<T>
}
@@ -0,0 +1,10 @@
// !LANGUAGE: -BoundCallableReferences
import kotlin.reflect.KClass
val <T : Any> KClass<T>.java: Class<T> get() = null!!
val <T : Any> KClass<T>.foo: Any?
get() {
return java.<!UNRESOLVED_REFERENCE!>lang<!>.<!UNRESOLVED_REFERENCE!>Integer<!>::hashCode
}
@@ -0,0 +1,28 @@
// !LANGUAGE: -CallableReferencesToClassMembersWithEmptyLHS
class A {
fun memberFunction() {}
val memberProperty: Int get() = 42
fun test() {
(::memberFunction)()
(::extensionFunction)()
(::memberProperty)()
(::extensionProperty)()
}
inner class B {
fun memberFunction() { }
val memberProperty: Int get() = 43
fun test() {
(::memberFunction)()
(::extensionFunction)()
(::memberProperty)()
(::extensionProperty)()
}
}
}
fun A.extensionFunction() {}
val A.extensionProperty: Int get() = 44
@@ -0,0 +1,23 @@
// !LANGUAGE: -DataClassInheritance
interface Allowed
open class NotAllowed
abstract data class Base(val x: Int)
class Derived: Base(42)
data class Nasty(val z: Int, val y: Int): Base(z)
data class Complex(val y: Int): Allowed, NotAllowed()
interface AbstractEqualsHashCodeToString {
override fun equals(other: Any?): Boolean
override fun hashCode(): Int
override fun toString(): String
}
data class ImplInterface(val s: String) : AbstractEqualsHashCodeToString
@@ -0,0 +1,11 @@
// !LANGUAGE: -InlineProperties
var value: Int = 0
inline var z: Int
get() = ++value
set(p: Int) { value = p }
var z2: Int
inline get() = ++value
inline set(p: Int) { value = p }
@@ -0,0 +1,21 @@
// !LANGUAGE: -LocalDelegatedProperties
import kotlin.reflect.KProperty
class Delegate {
operator fun getValue(t: Any?, p: KProperty<*>): Int = 1
}
fun foo(): Int {
val prop: Int by Delegate()
val prop2: Int by 123
val obj = object {
fun v(): Int {
val prop3: Int by Delegate()
return prop3
}
}
return prop + prop2 + obj.v()
}
@@ -0,0 +1,7 @@
expect fun foo1()
expect val bar1 = 42
expect class Baz1
actual fun foo2() = 42
actual val bar2: Int
actual interface Baz2
@@ -0,0 +1,5 @@
// !LANGUAGE: -TopLevelSealedInheritance
sealed class Base
class Derived : Base()