Analysis API: move testdata to corresponding components folders

This commit is contained in:
Ilya Kirillov
2021-11-17 18:42:35 +01:00
parent f833fc4bcb
commit 6f6a33e852
533 changed files with 0 additions and 0 deletions
@@ -0,0 +1,4 @@
open class A
class B : A
@@ -0,0 +1,2 @@
open class A
class B : A
@@ -0,0 +1,9 @@
abstract class A {
abstract class Nested
}
typealias TA = A
class B : TA() {
class NestedInB : Nested()
}
@@ -0,0 +1,7 @@
abstract class A {
abstract class Nested
}
typealias TA = A
class B : TA {
class NestedInB : A.Nested
}
@@ -0,0 +1,13 @@
package p
abstract class My {
abstract class NestedOne : My() {
abstract class NestedTwo : NestedOne() {
}
}
}
class Your : My() {
class NestedThree : NestedOne()
}
@@ -0,0 +1,8 @@
abstract class My {
abstract class NestedOne : My {
abstract class NestedTwo : My.NestedOne
}
}
class Your : My {
class NestedThree : My.NestedOne
}
@@ -0,0 +1,16 @@
@Target(allowedTargets = NOT_CONST_EXPRESSION) annotation class base
@base annotation class derived
@base class correct {
constructor(x: Int)
@base constructor()
@base val x: Int
}
@base enum class My {
FIRST,
SECOND,
}
@base fun foo(@base y: @base Int): Int {
@base fun bar(@base z: @base Int): Int
@base val local: Int
}
@base val z: Int
@@ -0,0 +1,20 @@
@Target(AnnotationTarget.ANNOTATION_CLASS) annotation class base
@base annotation class derived
@base class correct(@base val x: Int) {
@base constructor(): this(0)
}
@base enum class My {
@base FIRST,
@base SECOND
}
@base fun foo(@base y: @base Int): Int {
@base fun bar(@base z: @base Int) = z + 1
@base val local = bar(y)
return local
}
@base val z = 0
@@ -0,0 +1,16 @@
@Target(allowedTargets = NOT_CONST_EXPRESSION) annotation class base
@base annotation class derived
@base class correct {
constructor(@base x: Int)
@base constructor()
@base val x: Int
}
@base enum class My {
FIRST,
SECOND,
}
@base fun foo(@base y: @base Int): Int {
@base fun bar(@base z: @base Int): Int
@base val local: Int
}
@base val z: Int
@@ -0,0 +1,11 @@
package a.b
class C<T, out S> {
inner class D<R, in P> {
}
}
interface Test {
val x: a.b.C<out CharSequence, *>.D<in List<*>, *>
}
@@ -0,0 +1,6 @@
class C<T, out S> {
inner class D<R, in P>
}
interface Test {
val x: C<out CharSequence, *>.D<in List<*>, *>
}
@@ -0,0 +1,20 @@
object A {
constructor()
init {}
}
enum class B {
X() {
constructor()
}
}
class C {
companion object {
constructor()
}
}
val anonObject = object {
constructor()
}
@@ -0,0 +1,12 @@
object A {
constructor()
}
enum class B {
X,
}
class C {
companion object {
constructor()
}
}
val anonObject: Any
@@ -0,0 +1,10 @@
interface IFace<T> {
fun getStatus(arg: T): Boolean
}
class Some
private fun resolve(): IFace<Some> {
return object : IFace<Some> {
override fun getStatus(arg: Some) = true
}
}
@@ -0,0 +1,10 @@
interface IFace<T> {
fun getStatus(arg: T): Boolean
}
class Some
private fun resolve(): IFace<Some> {
object : IFace<Some> {
constructor()
override fun getStatus(arg: Some): Boolean
}
}
@@ -0,0 +1,19 @@
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KCallable
import kotlin.reflect.KProperty
public interface MyRwProperty<in T, V> {
public operator fun setValue(thisRef: T, property: Any, value: V)
public operator fun getValue(thisRef: T, property: Any): V
}
val x: Int by lazy { 1 + 2 }
val delegate = object: MyRwProperty<Any?, Int> {
override fun getValue(thisRef: Any?, property: Any): Int = 1
override fun setValue(thisRef: Any?, property: Any, value: Int) {}
}
val value by delegate
var variable by delegate
@@ -0,0 +1,12 @@
interface MyRwProperty<in T, V> {
operator fun getValue(thisRef: T, property: Any): V
operator fun setValue(thisRef: T, property: Any, value: V)
}
val x: Int
get()
val delegate: MyRwProperty<Any?, Int>
val value: Int
get()
var variable: Int
get()
set(value: Int)
@@ -0,0 +1,5 @@
open class Base<T>(val x: T)
class Derived<T : Any>(x: T) : Base<T>(x)
fun <T : Any> create(x: T): Derived<T> = Derived(x)
@@ -0,0 +1,8 @@
open class Base<T> {
constructor(x: T)
val x: T
}
class Derived<T : Any> : Base<T> {
constructor(x: T)
}
fun <T : Any> create(x: T): Derived<T>
@@ -0,0 +1,4 @@
fun test() {
val x = object {}
}
@@ -0,0 +1,3 @@
fun test() {
val x: Any
}
@@ -0,0 +1,46 @@
import my.println
enum class Order {
FIRST,
SECOND,
THIRD
}
enum class Planet(val m: Double, internal val r: Double) {
MERCURY(1.0, 2.0) {
override fun sayHello() {
println("Hello!!!")
}
},
VENERA(3.0, 4.0) {
override fun sayHello() {
println("Ola!!!")
}
},
EARTH(5.0, 6.0) {
override fun sayHello() {
println("Privet!!!")
}
};
val g: Double = G * m / (r * r)
abstract fun sayHello()
companion object {
const val G = 6.67e-11
}
}
enum class PseudoInsn(val signature: String = "()V") {
FIX_STACK_BEFORE_JUMP,
FAKE_ALWAYS_TRUE_IFEQ("()I"),
FAKE_ALWAYS_FALSE_IFEQ("()I"),
SAVE_STACK_BEFORE_TRY,
RESTORE_STACK_IN_TRY_CATCH,
STORE_NOT_NULL,
AS_NOT_NULL("(Ljava/lang/Object;)Ljava/lang/Object;")
;
fun emit() {}
}
@@ -0,0 +1,30 @@
enum class Order {
FIRST,
SECOND,
THIRD,
}
enum class Planet {
MERCURY,
VENERA,
EARTH,
constructor(m: Double, r: Double)
val g: Double
val m: Double
internal val r: Double
abstract fun sayHello()
companion object {
const val G: Double
}
}
enum class PseudoInsn {
FIX_STACK_BEFORE_JUMP,
FAKE_ALWAYS_TRUE_IFEQ,
FAKE_ALWAYS_FALSE_IFEQ,
SAVE_STACK_BEFORE_TRY,
RESTORE_STACK_IN_TRY_CATCH,
STORE_NOT_NULL,
AS_NOT_NULL,
constructor(signature: String = ...)
val signature: String
fun emit()
}
@@ -0,0 +1,16 @@
interface Some
object O1 : Some
object O2 : Some
enum class SomeEnum(val x: Some) {
FIRST(O1) {
override fun check(y: Some): Boolean = true
},
SECOND(O2) {
override fun check(y: Some): Boolean = y == O2
};
abstract fun check(y: Some): Boolean
}
@@ -0,0 +1,10 @@
interface Some
object O1 : Some
object O2 : Some
enum class SomeEnum {
FIRST,
SECOND,
constructor(x: Some)
val x: Some
abstract fun check(y: Some): Boolean
}
@@ -0,0 +1,11 @@
expect class MyClass
expect fun foo(): String
expect val x: Int
actual class MyClass
actual fun foo() = "Hello"
actual val x = 42
@@ -0,0 +1,6 @@
expect class MyClass
expect fun foo(): String
expect val x: Int
actual class MyClass
actual fun foo(): String
actual val x: Int
@@ -0,0 +1,8 @@
fun <T> simpleRun(f: (T) -> Unit): Unit = f()
fun <T, R> List<T>.simpleMap(f: (T) -> R): R {
}
fun <T> simpleWith(t: T, f: T.() -> Unit): Unit = t.f()
@@ -0,0 +1,3 @@
fun <T> simpleRun(f: (T) -> Unit)
fun <T, R> List<T>.simpleMap(f: (T) -> R): R
fun <T> simpleWith(t: T, f: T.() -> Unit)
@@ -0,0 +1,7 @@
interface Any
inline fun <reified T : Any> Any.safeAs(): T? = this as? T
abstract class Summator {
abstract fun <T> plus(first: T, second: T): T
}
@@ -0,0 +1,5 @@
interface Any
inline fun <reified T : Any> Any.safeAs(): T?
abstract class Summator {
abstract fun <T> plus(first: T, second: T): T
}
@@ -0,0 +1,3 @@
fun <T> genericFoo(): T = TODO()
val <T> T.generic: T get() = genericFoo()
@@ -0,0 +1,3 @@
fun <T> genericFoo(): T
val <T> T.generic: T
get()
@@ -0,0 +1,2 @@
private fun foo(x: Any) = if (x is String && x is Int) x else null
@@ -0,0 +1 @@
private fun foo(x: Any): Any?
@@ -0,0 +1,7 @@
abstract class Base(val s: String)
class Outer {
class Derived(s: String) : Base(s)
object Obj : Base("")
}
@@ -0,0 +1,10 @@
abstract class Base {
constructor(s: String)
val s: String
}
class Outer {
class Derived : Base {
constructor(s: String)
}
object Obj : Base
}
@@ -0,0 +1,9 @@
class NoPrimary {
val x: String
constructor(x: String) {
this.x = x
}
constructor(): this("")
}
@@ -0,0 +1,5 @@
class NoPrimary {
constructor()
constructor(x: String)
val x: String
}
@@ -0,0 +1,15 @@
interface SomeInterface {
fun foo(x: Int, y: String): String
val bar: Boolean
}
class SomeClass : SomeInterface {
private val baz = 42
override fun foo(x: Int, y: String): String {
return y + x + baz
}
override var bar: Boolean
get() = true
set(value) {}
lateinit var fau: Double
}
inline class InlineClass
@@ -0,0 +1,13 @@
interface SomeInterface {
val bar: Boolean
fun foo(x: Int, y: String): String
}
class SomeClass : SomeInterface {
override var bar: Boolean
get()
set(value: Boolean)
private val baz: Int
lateinit var fau: Double
override fun foo(x: Int, y: String): String
}
inline class InlineClass
@@ -0,0 +1,3 @@
fun foo() {}
suspend fun bar() {}
@@ -0,0 +1,2 @@
fun foo()
suspend fun bar()
@@ -0,0 +1,5 @@
interface B
typealias C = B
class D : C
@@ -0,0 +1,3 @@
interface B
typealias C = B
class D : C
@@ -0,0 +1,7 @@
open class A
interface B<S, T : A>
typealias C<T> = B<T, A>
class D : C<A>
@@ -0,0 +1,4 @@
open class A
interface B<S, T : A>
typealias C<T> = B<T, A>
class D : C<A>
@@ -0,0 +1,17 @@
package test
interface Some
abstract class My<T : Some> {
open inner class T
abstract val x: T
abstract fun foo(arg: T)
abstract val y: My<test.Some>.T
abstract val z: test.My<test.Some>.T
abstract class Some : My<test.Some>.T()
}
@@ -0,0 +1,9 @@
interface Some
abstract class My<T : Some> {
abstract val x: T
abstract val y: My<Some>.T
abstract val z: My<Some>.T
abstract fun foo(arg: T)
abstract class Some : My<Some>.T
open inner class T
}
@@ -0,0 +1,16 @@
interface List<out T : Any> {
operator fun get(index: Int): T
infix fun concat(other: List<T>): List<T>
}
typealias StringList = List<out String>
typealias AnyList = List<*>
abstract class AbstractList<out T : Any> : List<T>
class SomeList : AbstractList<Int>() {
override fun get(index: Int): Int = 42
override fun concat(other: List<Int>): List<Int> = this
}
@@ -0,0 +1,11 @@
interface List<out T : Any> {
infix fun concat(other: List<T>): List<T>
operator fun get(index: Int): T
}
typealias StringList = List<out String>
typealias AnyList = List<*>
abstract class AbstractList<out T : Any> : List<T>
class SomeList : AbstractList<Int> {
override infix fun concat(other: List<Int>): List<Int>
override operator fun get(index: Int): Int
}
@@ -0,0 +1,4 @@
@Target(AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.TYPE) annotation class base
fun foo1(vararg ints: Int) {}
fun foo2(@base vararg ints: @base Int) {}
@@ -0,0 +1,3 @@
@Target(allowedTargets = NOT_CONST_EXPRESSION) annotation class base
fun foo1(vararg ints: Int)
fun foo2(@base vararg ints: @base Int)
@@ -0,0 +1,3 @@
interface A
interface B
class C<T : A & B>
@@ -0,0 +1,6 @@
interface A
interface B
class C<T> where T : A, T : B {
}
@@ -0,0 +1,3 @@
interface A
interface B
class C<T : A> where T : B