Add test methods and data base on raw fir builder test data
This commit is contained in:
committed by
Mikhail Glukhikh
parent
fd8205e317
commit
8047aa22a4
@@ -0,0 +1,4 @@
|
||||
open class A
|
||||
|
||||
|
||||
class B : A
|
||||
@@ -0,0 +1,13 @@
|
||||
abstract class A {
|
||||
abstract class Nested
|
||||
}
|
||||
|
||||
typealias TA = A
|
||||
|
||||
// fun TA.<init>(): TA /* = A */
|
||||
// │
|
||||
class B : TA() {
|
||||
// constructor A.Nested()
|
||||
// │
|
||||
class NestedInB : Nested()
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package p
|
||||
|
||||
abstract class My {
|
||||
// constructor My()
|
||||
// │
|
||||
abstract class NestedOne : My() {
|
||||
// constructor My.NestedOne()
|
||||
// │
|
||||
abstract class NestedTwo : NestedOne() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// constructor My()
|
||||
// │
|
||||
class Your : My() {
|
||||
// constructor My.NestedOne()
|
||||
// │
|
||||
class NestedThree : NestedOne()
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package a.b
|
||||
|
||||
class C<T, out S> {
|
||||
inner class D<R, in P> {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
interface Test {
|
||||
// C<out CharSequence, *>.D<in collections/List<*>, *>
|
||||
// │ package a
|
||||
// │ │ package a/b
|
||||
// │ │ │ class C<T, S> collections/List<*>
|
||||
// │ │ │ │ │
|
||||
val x: a.b.C<out CharSequence, *>.D<in List<*>, *>
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
open class Base<T>(val x: T)
|
||||
|
||||
// constructor Base<T>(T)
|
||||
// │ Derived.<init>.x: T
|
||||
// │ │
|
||||
class Derived<T : Any>(x: T) : Base<T>(x)
|
||||
|
||||
// constructor Derived<T : Any>(T)
|
||||
// │ create.x: T
|
||||
// │ │
|
||||
fun <T : Any> create(x: T): Derived<T> = Derived(x)
|
||||
@@ -0,0 +1,62 @@
|
||||
import my.println
|
||||
|
||||
enum class Order {
|
||||
FIRST,
|
||||
SECOND,
|
||||
THIRD
|
||||
}
|
||||
|
||||
enum class Planet(val m: Double, internal val r: Double) {
|
||||
// constructor Planet(Double, Double)
|
||||
// │Double
|
||||
// ││ Double
|
||||
// ││ │
|
||||
MERCURY(1.0, 2.0) {
|
||||
override fun sayHello() {
|
||||
// fun io/println(Any?): Unit
|
||||
// │
|
||||
println("Hello!!!")
|
||||
}
|
||||
},
|
||||
// constructor Planet(Double, Double)
|
||||
// │Double
|
||||
// ││ Double
|
||||
// ││ │
|
||||
VENERA(3.0, 4.0) {
|
||||
override fun sayHello() {
|
||||
// fun io/println(Any?): Unit
|
||||
// │
|
||||
println("Ola!!!")
|
||||
}
|
||||
},
|
||||
// constructor Planet(Double, Double)
|
||||
// │Double
|
||||
// ││ Double
|
||||
// ││ │
|
||||
EARTH(5.0, 6.0) {
|
||||
override fun sayHello() {
|
||||
// fun io/println(Any?): Unit
|
||||
// │
|
||||
println("Privet!!!")
|
||||
}
|
||||
};
|
||||
|
||||
// val (Planet/Companion).G: Double
|
||||
// │ fun (Double).times(Double): Double
|
||||
// │ │ val (Planet).m: Double
|
||||
// │ │ │ fun (Double).div(Double): Double
|
||||
// │ │ │ │ val (Planet).r: Double
|
||||
// │ │ │ │ │ fun (Double).times(Double): Double
|
||||
// Double │ │ │ │ │ │ val (Planet).r: Double
|
||||
// │ │ │ │ │ │ │ │
|
||||
val g: Double = G * m / (r * r)
|
||||
|
||||
abstract fun sayHello()
|
||||
|
||||
companion object {
|
||||
// Double
|
||||
// │ Double
|
||||
// │ │
|
||||
const val G = 6.67e-11
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
interface Some
|
||||
|
||||
object O1 : Some
|
||||
|
||||
object O2 : Some
|
||||
|
||||
enum class SomeEnum(val x: Some) {
|
||||
// constructor SomeEnum(Some)
|
||||
// │object O1: Some
|
||||
// ││
|
||||
FIRST(O1) {
|
||||
// Boolean
|
||||
// │
|
||||
override fun check(y: Some): Boolean = true
|
||||
},
|
||||
// constructor SomeEnum(Some)
|
||||
// │object O2: Some
|
||||
// ││
|
||||
SECOND(O2) {
|
||||
// SomeEnum.SECOND.check.y: Some
|
||||
// │ fun (Any).equals(Any?): Boolean
|
||||
// │ │ object O2: Some
|
||||
// │ │ │
|
||||
override fun check(y: Some): Boolean = y == O2
|
||||
};
|
||||
|
||||
abstract fun check(y: Some): Boolean
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
expect class MyClass
|
||||
|
||||
expect fun foo(): String
|
||||
|
||||
// Int
|
||||
// │
|
||||
expect val x: Int
|
||||
|
||||
actual class MyClass
|
||||
|
||||
actual fun foo() = "Hello"
|
||||
|
||||
// Int Int
|
||||
// │ │
|
||||
actual val x = 42
|
||||
@@ -0,0 +1,15 @@
|
||||
// fun ((T) -> Unit).invoke(T): Unit
|
||||
// │
|
||||
fun <T> simpleRun(f: (T) -> Unit): Unit = f()
|
||||
|
||||
// collections/List<T>
|
||||
// │
|
||||
fun <T, R> List<T>.simpleMap(f: (T) -> R): R {
|
||||
|
||||
}
|
||||
|
||||
// simpleWith.t: T
|
||||
// │ fun T.invoke(): Unit
|
||||
// │ │
|
||||
fun <T> simpleWith(t: T, f: T.() -> Unit): Unit = t.f()
|
||||
|
||||
@@ -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,7 @@
|
||||
// fun TODO(): Nothing
|
||||
// │
|
||||
fun <T> genericFoo(): T = TODO()
|
||||
|
||||
// T fun <T> genericFoo(): T
|
||||
// │ │
|
||||
val <T> T.generic: T get() = genericFoo()
|
||||
@@ -0,0 +1,12 @@
|
||||
abstract class Base(val s: String)
|
||||
|
||||
class Outer {
|
||||
// constructor Base(String)
|
||||
// │ Outer.Derived.<init>.s: String
|
||||
// │ │
|
||||
class Derived(s: String) : Base(s)
|
||||
|
||||
// constructor Base(String)
|
||||
// │
|
||||
object Obj : Base("")
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
class NoPrimary {
|
||||
// String
|
||||
// │
|
||||
val x: String
|
||||
|
||||
constructor(x: String) {
|
||||
// val (NoPrimary).x: String
|
||||
// │ NoPrimary.<init>.x: String
|
||||
// │ │
|
||||
this.x = x
|
||||
}
|
||||
|
||||
constructor(): this("")
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
interface SomeInterface {
|
||||
fun foo(x: Int, y: String): String
|
||||
|
||||
// Boolean
|
||||
// │
|
||||
val bar: Boolean
|
||||
}
|
||||
|
||||
class SomeClass : SomeInterface {
|
||||
// Int Int
|
||||
// │ │
|
||||
private val baz = 42
|
||||
|
||||
override fun foo(x: Int, y: String): String {
|
||||
// SomeClass.foo.y: String
|
||||
// │ fun (String).plus(Any?): String
|
||||
// │ │ SomeClass.foo.x: Int
|
||||
// │ │ │ fun (String).plus(Any?): String
|
||||
// │ │ │ │ val (SomeClass).baz: Int
|
||||
// │ │ │ │ │
|
||||
return y + x + baz
|
||||
}
|
||||
|
||||
// Boolean
|
||||
// │
|
||||
override var bar: Boolean
|
||||
// Boolean
|
||||
// │
|
||||
get() = true
|
||||
set(value) {}
|
||||
|
||||
// Double
|
||||
// │
|
||||
lateinit var fau: Double
|
||||
}
|
||||
|
||||
inline class InlineClass
|
||||
@@ -0,0 +1,3 @@
|
||||
fun foo() {}
|
||||
|
||||
suspend fun bar() {}
|
||||
@@ -0,0 +1,7 @@
|
||||
interface B
|
||||
|
||||
typealias C = B
|
||||
|
||||
// C /* = B */
|
||||
// │
|
||||
class D : C
|
||||
@@ -0,0 +1,9 @@
|
||||
open class A
|
||||
|
||||
interface B<S, T : A>
|
||||
|
||||
typealias C<T> = B<T, A>
|
||||
|
||||
// C<A> /* = B<A, A> */
|
||||
// │
|
||||
class D : C<A>
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package test
|
||||
|
||||
interface Some
|
||||
|
||||
abstract class My<T : Some> {
|
||||
inner class T
|
||||
|
||||
// T
|
||||
// │
|
||||
abstract val x: T
|
||||
|
||||
abstract fun foo(arg: T)
|
||||
|
||||
// [ERROR : T]
|
||||
// │ class My<T : Some>
|
||||
// │ │
|
||||
abstract val y: My.T
|
||||
|
||||
// [ERROR : T]
|
||||
// │ package test
|
||||
// │ │ class My<T : Some>
|
||||
// │ │ │
|
||||
abstract val z: test.My.T
|
||||
|
||||
// [ERROR : T]
|
||||
// │
|
||||
class Some : T()
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
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>
|
||||
|
||||
// constructor AbstractList<T : Any>()
|
||||
// │
|
||||
class SomeList : AbstractList<Int>() {
|
||||
// Int
|
||||
// │
|
||||
override fun get(index: Int): Int = 42
|
||||
|
||||
override fun concat(other: List<Int>): List<Int> = this
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
interface A
|
||||
interface B
|
||||
|
||||
class C<T> where T : A, T : B {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user