[FIR-TEST] Move analysis tests to separate module

This commit is contained in:
Dmitriy Novozhilov
2020-03-18 15:10:46 +03:00
parent 3a479d5d16
commit cc07ae96b3
1477 changed files with 1001 additions and 980 deletions
@@ -0,0 +1,46 @@
// FILE: annotations.kt
package annotations
@Target(AnnotationTarget.FILE, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.PROPERTY_GETTER)
annotation class Simple
annotation class WithInt(val value: Int)
annotation class WithString(val s: String)
annotation class Complex(val wi: WithInt, val ws: WithString)
annotation class VeryComplex(val f: Float, val d: Double, val b: Boolean, val l: Long, val n: Int?)
// FILE: main.kt
@file:Simple
package test
import annotations.*
@WithInt(42)
abstract class First {
@Simple
abstract fun foo(@WithString("abc") arg: @Simple Double)
@Complex(WithInt(7), WithString(""))
abstract val v: String
}
@WithString("xyz")
class Second(val y: Char) : @WithInt(0) First() {
override fun foo(arg: Double) {
}
override val v: String
@Simple get() = ""
@WithString("constructor")
constructor(): this('\n')
}
@WithInt(24)
@VeryComplex(3.14f, 6.67e-11, false, 123456789012345L, null)
typealias Third = @Simple Second
@@ -0,0 +1,94 @@
FILE: annotations.kt
@R|kotlin/annotation/Target|(Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.FILE|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.FUNCTION|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.TYPE|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.PROPERTY_GETTER|) public final annotation class Simple : R|kotlin/Annotation| {
public constructor(): R|annotations/Simple| {
super<R|kotlin/Any|>()
}
}
public final annotation class WithInt : R|kotlin/Annotation| {
public constructor(value: R|kotlin/Int|): R|annotations/WithInt| {
super<R|kotlin/Any|>()
}
public final val value: R|kotlin/Int| = R|<local>/value|
public get(): R|kotlin/Int|
}
public final annotation class WithString : R|kotlin/Annotation| {
public constructor(s: R|kotlin/String|): R|annotations/WithString| {
super<R|kotlin/Any|>()
}
public final val s: R|kotlin/String| = R|<local>/s|
public get(): R|kotlin/String|
}
public final annotation class Complex : R|kotlin/Annotation| {
public constructor(wi: R|annotations/WithInt|, ws: R|annotations/WithString|): R|annotations/Complex| {
super<R|kotlin/Any|>()
}
public final val wi: R|annotations/WithInt| = R|<local>/wi|
public get(): R|annotations/WithInt|
public final val ws: R|annotations/WithString| = R|<local>/ws|
public get(): R|annotations/WithString|
}
public final annotation class VeryComplex : R|kotlin/Annotation| {
public constructor(f: R|kotlin/Float|, d: R|kotlin/Double|, b: R|kotlin/Boolean|, l: R|kotlin/Long|, n: R|kotlin/Int?|): R|annotations/VeryComplex| {
super<R|kotlin/Any|>()
}
public final val f: R|kotlin/Float| = R|<local>/f|
public get(): R|kotlin/Float|
public final val d: R|kotlin/Double| = R|<local>/d|
public get(): R|kotlin/Double|
public final val b: R|kotlin/Boolean| = R|<local>/b|
public get(): R|kotlin/Boolean|
public final val l: R|kotlin/Long| = R|<local>/l|
public get(): R|kotlin/Long|
public final val n: R|kotlin/Int?| = R|<local>/n|
public get(): R|kotlin/Int?|
}
FILE: main.kt
@FILE:R|annotations/Simple|()
@R|annotations/WithInt|(Int(42)) public abstract class First : R|kotlin/Any| {
public constructor(): R|test/First| {
super<R|kotlin/Any|>()
}
@R|annotations/Simple|() public abstract fun foo(@R|annotations/WithString|(String(abc)) arg: @R|annotations/Simple|() R|kotlin/Double|): R|kotlin/Unit|
@R|annotations/Complex|(R|annotations/WithInt.WithInt|(Int(7)), R|annotations/WithString.WithString|(String())) public abstract val v: R|kotlin/String|
public get(): R|kotlin/String|
}
@R|annotations/WithString|(String(xyz)) public final class Second : @R|annotations/WithInt|(IntegerLiteral(0)) R|test/First| {
public constructor(y: R|kotlin/Char|): R|test/Second| {
super<@R|annotations/WithInt|(IntegerLiteral(0)) R|test/First|>()
}
public final val y: R|kotlin/Char| = R|<local>/y|
public get(): R|kotlin/Char|
public final override fun foo(arg: R|kotlin/Double|): R|kotlin/Unit| {
}
public final override val v: R|kotlin/String|
@R|annotations/Simple|() public get(): R|kotlin/String| {
^ String()
}
@R|annotations/WithString|(String(constructor)) public constructor(): R|test/Second| {
this<R|test/Second|>(Char(
))
}
}
@R|annotations/WithInt|(Int(24)) @R|annotations/VeryComplex|(Float(3.14), Double(6.67E-11), Boolean(false), Long(123456789012345), Null(null)) @R|annotations/WithInt|(Int(24)) @R|annotations/VeryComplex|(Float(3.14), Double(6.67E-11), Boolean(false), Long(123456789012345), Null(null)) public final typealias Third = @R|annotations/Simple|() R|test/Second|
@@ -0,0 +1,18 @@
// FILE: byteArray.kt
package Test
interface ByteArray {
val array: ByteArray
}
// FILE: main.kt
package use
import test.*
interface My {
// Should be kotlin.ByteArray
val array: ByteArray
}
@@ -0,0 +1,12 @@
FILE: byteArray.kt
public abstract interface ByteArray : R|kotlin/Any| {
public abstract val array: R|Test/ByteArray|
public get(): R|Test/ByteArray|
}
FILE: main.kt
public abstract interface My : R|kotlin/Any| {
public abstract val array: R|kotlin/ByteArray|
public get(): R|kotlin/ByteArray|
}
@@ -0,0 +1,28 @@
// FILE: C.kt
package c
open class C {
open class NestedInC
}
// FILE: B.kt
package b
import c.C
open class B : C() {
open class NestedInB : NestedInC()
}
// FILE: A.kt
package a
import b.B
class A : B() {
class NestedInA1 : NestedInB()
class NestedInA2 : NestedInC()
}
@@ -0,0 +1,49 @@
FILE: C.kt
public open class C : R|kotlin/Any| {
public constructor(): R|c/C| {
super<R|kotlin/Any|>()
}
public open class NestedInC : R|kotlin/Any| {
public constructor(): R|c/C.NestedInC| {
super<R|kotlin/Any|>()
}
}
}
FILE: B.kt
public open class B : R|c/C| {
public constructor(): R|b/B| {
super<R|c/C|>()
}
public open class NestedInB : R|c/C.NestedInC| {
public constructor(): R|b/B.NestedInB| {
super<R|c/C.NestedInC|>()
}
}
}
FILE: A.kt
public final class A : R|b/B| {
public constructor(): R|a/A| {
super<R|b/B|>()
}
public final class NestedInA1 : R|b/B.NestedInB| {
public constructor(): R|a/A.NestedInA1| {
super<R|b/B.NestedInB|>()
}
}
public final class NestedInA2 : R|c/C.NestedInC| {
public constructor(): R|a/A.NestedInA2| {
super<R|c/C.NestedInC|>()
}
}
}
@@ -0,0 +1,15 @@
// FILE: B.kt
package b
class A
typealias TA = A
// FILE: A.kt
package a
import b.TA
class MyClass : TA()
@@ -0,0 +1,15 @@
FILE: B.kt
public final class A : R|kotlin/Any| {
public constructor(): R|b/A| {
super<R|kotlin/Any|>()
}
}
public final typealias TA = R|b/A|
FILE: A.kt
public final class MyClass : R|b/TA| {
public constructor(): R|a/MyClass| {
super<R|b/TA|>()
}
}
@@ -0,0 +1,16 @@
// FILE: a.kt
package a
object A {
fun foo() {}
}
// FILE: b.kt
package b
import a.A.foo
fun bar() {
foo()
}
@@ -0,0 +1,14 @@
FILE: a.kt
public final object A : R|kotlin/Any| {
private constructor(): R|a/A| {
super<R|kotlin/Any|>()
}
public final fun foo(): R|kotlin/Unit| {
}
}
FILE: b.kt
public final fun bar(): R|kotlin/Unit| {
R|a/A.foo|()
}
@@ -0,0 +1,23 @@
// FILE: test.kt
package test
sealed class Test {
object O : Test()
class Extra(val x: Int): Test
}
// FILE: main.kt
package other
import test.Test.*
abstract class Factory {
abstract fun createTest(): Test
abstract fun createObj(): O
abstract fun createExtra(): Extra
}
@@ -0,0 +1,37 @@
FILE: test.kt
public sealed class Test : R|kotlin/Any| {
private constructor(): R|test/Test| {
super<R|kotlin/Any|>()
}
public final object O : R|test/Test| {
private constructor(): R|test/Test.O| {
super<R|test/Test|>()
}
}
public final class Extra : R|test/Test| {
public constructor(x: R|kotlin/Int|): R|test/Test.Extra| {
super<R|kotlin/Any|>()
}
public final val x: R|kotlin/Int| = R|<local>/x|
public get(): R|kotlin/Int|
}
}
FILE: main.kt
public abstract class Factory : R|kotlin/Any| {
public constructor(): R|other/Factory| {
super<R|kotlin/Any|>()
}
public abstract fun createTest(): R|ERROR CLASS: Symbol not found, for `Test`|
public abstract fun createObj(): R|test/Test.O|
public abstract fun createExtra(): R|test/Test.Extra|
}
@@ -0,0 +1,24 @@
// FILE: B.kt
package b
abstract class MyClass
fun foo() {}
fun I() {}
interface I {}
// FILE: A.kt
package a
import b.MyClass as HisClass
import b.foo as foo2
import b.I as I2
class YourClass : HisClass()
fun bar() {
foo2()
I2()
}
@@ -0,0 +1,24 @@
FILE: B.kt
public abstract class MyClass : R|kotlin/Any| {
public constructor(): R|b/MyClass| {
super<R|kotlin/Any|>()
}
}
public final fun foo(): R|kotlin/Unit| {
}
public final fun I(): R|kotlin/Unit| {
}
public abstract interface I : R|kotlin/Any| {
}
FILE: A.kt
public final class YourClass : R|b/MyClass| {
public constructor(): R|a/YourClass| {
super<R|b/MyClass|>()
}
}
public final fun bar(): R|kotlin/Unit| {
R|b/foo|()
R|b/I|()
}
@@ -0,0 +1,25 @@
// FILE: B.kt
package b
abstract class MyClass
fun foo() {}
fun I() {}
interface I {}
// FILE: A.kt
package a
import b.MyClass
import b.foo
import b.I
class YourClass : MyClass()
fun bar() {
foo()
I()
}
@@ -0,0 +1,24 @@
FILE: B.kt
public abstract class MyClass : R|kotlin/Any| {
public constructor(): R|b/MyClass| {
super<R|kotlin/Any|>()
}
}
public final fun foo(): R|kotlin/Unit| {
}
public final fun I(): R|kotlin/Unit| {
}
public abstract interface I : R|kotlin/Any| {
}
FILE: A.kt
public final class YourClass : R|b/MyClass| {
public constructor(): R|a/YourClass| {
super<R|b/MyClass|>()
}
}
public final fun bar(): R|kotlin/Unit| {
R|b/foo|()
R|b/I|()
}
@@ -0,0 +1,15 @@
// FILE: A.kt
package a
class MyClass {
open class MyNested
}
// FILE: B.kt
package b
import a.MyClass.MyNested
class YourClass : MyNested()
@@ -0,0 +1,21 @@
FILE: A.kt
public final class MyClass : R|kotlin/Any| {
public constructor(): R|a/MyClass| {
super<R|kotlin/Any|>()
}
public open class MyNested : R|kotlin/Any| {
public constructor(): R|a/MyClass.MyNested| {
super<R|kotlin/Any|>()
}
}
}
FILE: B.kt
public final class YourClass : R|a/MyClass.MyNested| {
public constructor(): R|b/YourClass| {
super<R|a/MyClass.MyNested|>()
}
}
@@ -0,0 +1,15 @@
// FILE: A.kt
package a
class Outer {
open class Nested
}
// FILE: B.kt
package b
import a.Outer
class My : Outer.Nested()
@@ -0,0 +1,21 @@
FILE: A.kt
public final class Outer : R|kotlin/Any| {
public constructor(): R|a/Outer| {
super<R|kotlin/Any|>()
}
public open class Nested : R|kotlin/Any| {
public constructor(): R|a/Outer.Nested| {
super<R|kotlin/Any|>()
}
}
}
FILE: B.kt
public final class My : R|a/Outer.Nested| {
public constructor(): R|b/My| {
super<R|a/Outer.Nested|>()
}
}
@@ -0,0 +1,21 @@
// FILE: B.kt
package b.d
expect interface Other
expect class Another
fun baz() {}
// FILE: A.kt
package a.d
import b.d.*
fun foo(arg: Other): Another
fun bar() {
baz()
}
@@ -0,0 +1,16 @@
FILE: B.kt
public abstract expect interface Other : R|kotlin/Any| {
}
public final expect class Another : R|kotlin/Any| {
public constructor(): R|b/d/Another| {
super<R|kotlin/Any|>()
}
}
public final fun baz(): R|kotlin/Unit| {
}
FILE: A.kt
public final fun foo(arg: R|b/d/Other|): R|b/d/Another|
public final fun bar(): R|kotlin/Unit| {
R|b/d/baz|()
}