mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
[Test] Delete obsolete descriptor renderer tests
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
annotation class Ann(val x: String)
|
||||
|
||||
fun foo(block: () -> Unit) = block.javaClass
|
||||
|
||||
fun box() {
|
||||
foo( @Ann("OK1") fun() {})
|
||||
}
|
||||
|
||||
//@Ann(x = "OK1") local final fun <no name provided>(): kotlin.Unit defined in box
|
||||
@@ -1,9 +0,0 @@
|
||||
annotation class Ann(val x: String)
|
||||
|
||||
fun foo(block: (Int, String) -> Unit) = block.javaClass
|
||||
|
||||
fun box() {
|
||||
foo( @Ann("OK1") fun(@Ann("1") x: Int, @Ann("2") y: String) {})
|
||||
}
|
||||
|
||||
//@Ann(x = "OK1") local final fun <no name provided>(/*0*/ @Ann(x = "1") x: kotlin.Int, /*1*/ @Ann(x = "2") y: kotlin.String): kotlin.Unit defined in box
|
||||
@@ -1,12 +0,0 @@
|
||||
annotation class Ann(val x: String)
|
||||
|
||||
fun foo(block: () -> Unit) = block.javaClass
|
||||
|
||||
fun box() {
|
||||
foo( @Ann("OK1") { })
|
||||
|
||||
foo() @Ann("OK2") { }
|
||||
}
|
||||
|
||||
//@Ann(x = "OK1") local final fun <anonymous>(): kotlin.Unit defined in box
|
||||
//@Ann(x = "OK2") local final fun <anonymous>(): kotlin.Unit defined in box
|
||||
@@ -1,12 +0,0 @@
|
||||
annotation class Ann(val x: String)
|
||||
|
||||
fun foo(block: () -> Unit) = block.javaClass
|
||||
|
||||
fun box() {
|
||||
foo( @Ann("OK1") label@{ })
|
||||
|
||||
foo() @Ann("OK2") label@{ }
|
||||
}
|
||||
|
||||
//@Ann(x = "OK1") local final fun <anonymous>(): kotlin.Unit defined in box
|
||||
//@Ann(x = "OK2") local final fun <anonymous>(): kotlin.Unit defined in box
|
||||
@@ -1,9 +0,0 @@
|
||||
annotation class Ann(val x: String)
|
||||
|
||||
fun foo(block: () -> Unit) = block.javaClass
|
||||
|
||||
fun box() {
|
||||
foo( @Ann("OK1") (fun() {}))
|
||||
}
|
||||
|
||||
//local final fun <no name provided>(): kotlin.Unit defined in box
|
||||
@@ -1,9 +0,0 @@
|
||||
annotation class Ann(val x: String)
|
||||
|
||||
fun foo(block: () -> Unit) = block.javaClass
|
||||
|
||||
fun box() {
|
||||
foo( @Ann("OK1") ({ }))
|
||||
}
|
||||
|
||||
//local final fun <anonymous>(): kotlin.Unit defined in box
|
||||
69
compiler/testData/renderer/Classes.kt
vendored
69
compiler/testData/renderer/Classes.kt
vendored
@@ -1,69 +0,0 @@
|
||||
package rendererTest
|
||||
|
||||
annotation class TheAnnotation
|
||||
annotation class AnotherAnnotation
|
||||
|
||||
@TheAnnotation
|
||||
public open class TheClass<out T : Int, X> @AnotherAnnotation constructor() {
|
||||
private val privateVal: Int = 5
|
||||
|
||||
val shouldBeFinal: Int = 5
|
||||
|
||||
val <T> T.checkTypeParameterScope: Int get() = 6
|
||||
val <T> checkTypeParameterScope2 = 6
|
||||
|
||||
protected abstract fun foo() {}
|
||||
|
||||
@TheAnnotation private constructor()
|
||||
|
||||
private class Inner {}
|
||||
}
|
||||
|
||||
internal class InternalClass {
|
||||
}
|
||||
|
||||
interface TheTrait {
|
||||
fun abstractFun()
|
||||
|
||||
companion object : TheClass<Int, Int> {
|
||||
fun classObjectFunction(): Int {}
|
||||
}
|
||||
}
|
||||
|
||||
public class WithReified<reified A, reified out B>
|
||||
|
||||
public interface TwoUpperBounds<T> where T : Number, T : Any
|
||||
|
||||
//package rendererTest
|
||||
//public final annotation class TheAnnotation : kotlin.Annotation defined in rendererTest
|
||||
//public constructor TheAnnotation() defined in rendererTest.TheAnnotation
|
||||
//public final annotation class AnotherAnnotation : kotlin.Annotation defined in rendererTest
|
||||
//public constructor AnotherAnnotation() defined in rendererTest.AnotherAnnotation
|
||||
//@rendererTest.TheAnnotation public open class TheClass<out T : kotlin.Int, X> defined in rendererTest
|
||||
//<out T : kotlin.Int> defined in rendererTest.TheClass
|
||||
//<X> defined in rendererTest.TheClass
|
||||
//@rendererTest.AnotherAnnotation public constructor TheClass<out T : kotlin.Int, X>() defined in rendererTest.TheClass
|
||||
//private final val privateVal: kotlin.Int defined in rendererTest.TheClass
|
||||
//public final val shouldBeFinal: kotlin.Int defined in rendererTest.TheClass
|
||||
//public final val <T> T.checkTypeParameterScope: kotlin.Int defined in rendererTest.TheClass
|
||||
//<T> defined in rendererTest.TheClass.checkTypeParameterScope
|
||||
//public final fun T.<get-checkTypeParameterScope>(): kotlin.Int defined in rendererTest.TheClass
|
||||
//public final val <T> checkTypeParameterScope2: kotlin.Int defined in rendererTest.TheClass
|
||||
//<T> defined in rendererTest.TheClass.checkTypeParameterScope2
|
||||
//protected abstract fun foo(): kotlin.Unit defined in rendererTest.TheClass
|
||||
//@rendererTest.TheAnnotation private constructor TheClass<out T : kotlin.Int, X>() defined in rendererTest.TheClass
|
||||
//private final class Inner defined in rendererTest.TheClass
|
||||
//public constructor Inner() defined in rendererTest.TheClass.Inner
|
||||
//internal final class InternalClass defined in rendererTest
|
||||
//public constructor InternalClass() defined in rendererTest.InternalClass
|
||||
//public interface TheTrait defined in rendererTest
|
||||
//public abstract fun abstractFun(): kotlin.Unit defined in rendererTest.TheTrait
|
||||
//public companion object : rendererTest.TheClass<kotlin.Int, kotlin.Int> defined in rendererTest.TheTrait
|
||||
//private constructor Companion() defined in rendererTest.TheTrait.Companion
|
||||
//public final fun classObjectFunction(): kotlin.Int defined in rendererTest.TheTrait.Companion
|
||||
//public final class WithReified<reified A, reified out B> defined in rendererTest
|
||||
//public constructor WithReified<reified A, reified out B>() defined in rendererTest.WithReified
|
||||
//<reified A> defined in rendererTest.WithReified
|
||||
//<reified out B> defined in rendererTest.WithReified
|
||||
//public interface TwoUpperBounds<T : kotlin.Number> where T : kotlin.Any defined in rendererTest
|
||||
//<T : kotlin.Number & kotlin.Any> defined in rendererTest.TwoUpperBounds
|
||||
12
compiler/testData/renderer/Enum.kt
vendored
12
compiler/testData/renderer/Enum.kt
vendored
@@ -1,12 +0,0 @@
|
||||
package rendererTest
|
||||
|
||||
private enum class TheEnum(val rgb: Int) {
|
||||
VAL1(0xFF0000)
|
||||
}
|
||||
|
||||
//package rendererTest
|
||||
//private final enum class TheEnum : kotlin.Enum<rendererTest.TheEnum> defined in rendererTest
|
||||
//private constructor TheEnum(rgb: kotlin.Int) defined in rendererTest.TheEnum
|
||||
//value-parameter rgb: kotlin.Int defined in rendererTest.TheEnum.<init>
|
||||
//enum entry VAL1 defined in rendererTest.TheEnum
|
||||
//private constructor VAL1() defined in rendererTest.TheEnum.VAL1
|
||||
3
compiler/testData/renderer/ErrorType.kt
vendored
3
compiler/testData/renderer/ErrorType.kt
vendored
@@ -1,3 +0,0 @@
|
||||
val a: E = 0
|
||||
|
||||
//public val a: [ERROR : E] defined in root package
|
||||
49
compiler/testData/renderer/FunctionTypes.kt
vendored
49
compiler/testData/renderer/FunctionTypes.kt
vendored
@@ -1,49 +0,0 @@
|
||||
var v0: () -> Unit
|
||||
var v1: (Int) -> Int
|
||||
var v2: (number: Int, String) -> String
|
||||
var v3: Function1<Int, String>
|
||||
var v4: (() -> Int, (s: String) -> Unit) -> String
|
||||
var v5: Int.() -> Int
|
||||
var v6 : Int.(String, Int) -> Unit
|
||||
var v7 : @ExtensionFunctionType Function2<Int, String, Boolean>
|
||||
|
||||
class F: Function0<Unit>
|
||||
var v8: F
|
||||
|
||||
class EF: @ExtensionFunctionType Function1<String, Unit>
|
||||
var v9: EF
|
||||
|
||||
class GF<T>: Function0<T>
|
||||
var v10: GF<Any>
|
||||
|
||||
class GEF<A, B>: @ExtensionFunctionType Function1<A, B>
|
||||
var v11: GEF<Any, Any>
|
||||
|
||||
var v12: (() -> Unit).() -> Unit
|
||||
var v13: (() -> Unit)?.() -> Unit
|
||||
|
||||
//public var v0: () -> kotlin.Unit defined in root package
|
||||
//public var v1: (kotlin.Int) -> kotlin.Int defined in root package
|
||||
//public var v2: (number: kotlin.Int, kotlin.String) -> kotlin.String defined in root package
|
||||
//public var v3: (kotlin.Int) -> kotlin.String defined in root package
|
||||
//public var v4: (() -> kotlin.Int, (s: kotlin.String) -> kotlin.Unit) -> kotlin.String defined in root package
|
||||
//public var v5: kotlin.Int.() -> kotlin.Int defined in root package
|
||||
//public var v6: kotlin.Int.(kotlin.String, kotlin.Int) -> kotlin.Unit defined in root package
|
||||
//public var v7: kotlin.Int.(kotlin.String) -> kotlin.Boolean defined in root package
|
||||
//public final class F : () -> kotlin.Unit defined in root package
|
||||
//public constructor F() defined in F
|
||||
//public var v8: F defined in root package
|
||||
//public final class EF : kotlin.String.() -> kotlin.Unit defined in root package
|
||||
//public constructor EF() defined in EF
|
||||
//public var v9: EF defined in root package
|
||||
//public final class GF<T> : () -> T defined in root package
|
||||
//public constructor GF<T>() defined in GF
|
||||
//<T> defined in GF
|
||||
//public var v10: GF<kotlin.Any> defined in root package
|
||||
//public final class GEF<A, B> : A.() -> B defined in root package
|
||||
//public constructor GEF<A, B>() defined in GEF
|
||||
//<A> defined in GEF
|
||||
//<B> defined in GEF
|
||||
//public var v11: GEF<kotlin.Any, kotlin.Any> defined in root package
|
||||
//public var v12: (() -> kotlin.Unit).() -> kotlin.Unit defined in root package
|
||||
//public var v13: (() -> kotlin.Unit)?.() -> kotlin.Unit defined in root package
|
||||
@@ -1,42 +0,0 @@
|
||||
package test
|
||||
|
||||
fun Function0<Unit>.f1(f: Function0<Unit>): Function0<Int> {
|
||||
}
|
||||
|
||||
fun (() -> Unit).f2(f: Function0<Unit>) : Function0<Int> {
|
||||
}
|
||||
|
||||
fun ((() -> Unit) -> Unit).f3(f: Function0<Function0<Unit>>) : Function0<Function0<Int>> {
|
||||
}
|
||||
|
||||
fun Function0<() -> Unit>.f4(f: (() -> Unit, () -> Unit) -> Unit): Function1<() -> Unit, () -> Unit> {
|
||||
}
|
||||
|
||||
fun Function0<(() -> Unit) -> (() -> Unit)>.f5() {
|
||||
}
|
||||
|
||||
fun Function0<(() -> Unit) -> (() -> Unit)>?.f6() {
|
||||
}
|
||||
|
||||
fun ((p: Int) -> Unit)?.f7() {
|
||||
}
|
||||
|
||||
fun <T> (T.(Int) -> Unit).f8() {
|
||||
}
|
||||
|
||||
val Function0<(() -> Unit) -> (() -> Unit)>.p: Unit = Unit
|
||||
//package test
|
||||
//public fun (() -> kotlin.Unit).f1(f: () -> kotlin.Unit): () -> kotlin.Int defined in test
|
||||
//value-parameter f: () -> kotlin.Unit defined in test.f1
|
||||
//public fun (() -> kotlin.Unit).f2(f: () -> kotlin.Unit): () -> kotlin.Int defined in test
|
||||
//value-parameter f: () -> kotlin.Unit defined in test.f2
|
||||
//public fun ((() -> kotlin.Unit) -> kotlin.Unit).f3(f: () -> () -> kotlin.Unit): () -> () -> kotlin.Int defined in test
|
||||
//value-parameter f: () -> () -> kotlin.Unit defined in test.f3
|
||||
//public fun (() -> () -> kotlin.Unit).f4(f: (() -> kotlin.Unit, () -> kotlin.Unit) -> kotlin.Unit): (() -> kotlin.Unit) -> () -> kotlin.Unit defined in test
|
||||
//value-parameter f: (() -> kotlin.Unit, () -> kotlin.Unit) -> kotlin.Unit defined in test.f4
|
||||
//public fun (() -> (() -> kotlin.Unit) -> () -> kotlin.Unit).f5(): kotlin.Unit defined in test
|
||||
//public fun (() -> (() -> kotlin.Unit) -> () -> kotlin.Unit)?.f6(): kotlin.Unit defined in test
|
||||
//public fun ((p: kotlin.Int) -> kotlin.Unit)?.f7(): kotlin.Unit defined in test
|
||||
//public fun <T> (T.(kotlin.Int) -> kotlin.Unit).f8(): kotlin.Unit defined in test
|
||||
//<T> defined in test.f8
|
||||
//public val (() -> (() -> kotlin.Unit) -> () -> kotlin.Unit).p: kotlin.Unit defined in test
|
||||
38
compiler/testData/renderer/GlobalFunctions.kt
vendored
38
compiler/testData/renderer/GlobalFunctions.kt
vendored
@@ -1,38 +0,0 @@
|
||||
package rendererTest
|
||||
|
||||
public fun pub() {}
|
||||
|
||||
internal fun int: String {}
|
||||
|
||||
fun int2(vararg ints: Int): Int = 5
|
||||
|
||||
private fun prv(a: String, b: Int = 5) = 5
|
||||
|
||||
public fun Int.ext(): Int {}
|
||||
|
||||
public fun <out T> withTypeParam(a: Array<T>): Int {}
|
||||
|
||||
interface Foo
|
||||
interface Bar
|
||||
|
||||
fun <P> funTypeParameterWithTwoUpperBounds() where P : Foo, P : Bar = 17
|
||||
|
||||
@Deprecated("") fun deprecatedFun()
|
||||
|
||||
//package rendererTest
|
||||
//public fun pub(): kotlin.Unit defined in rendererTest
|
||||
//internal fun int(): kotlin.String defined in rendererTest
|
||||
//public fun int2(vararg ints: kotlin.Int): kotlin.Int defined in rendererTest
|
||||
//value-parameter vararg ints: kotlin.Int defined in rendererTest.int2
|
||||
//private fun prv(a: kotlin.String, b: kotlin.Int = ...): kotlin.Int defined in rendererTest
|
||||
//value-parameter a: kotlin.String defined in rendererTest.prv
|
||||
//value-parameter b: kotlin.Int = ... defined in rendererTest.prv
|
||||
//public fun kotlin.Int.ext(): kotlin.Int defined in rendererTest
|
||||
//public fun <out T> withTypeParam(a: kotlin.Array<T>): kotlin.Int defined in rendererTest
|
||||
//<out T> defined in rendererTest.withTypeParam
|
||||
//value-parameter a: kotlin.Array<T> defined in rendererTest.withTypeParam
|
||||
//public interface Foo defined in rendererTest
|
||||
//public interface Bar defined in rendererTest
|
||||
//public fun <P : rendererTest.Foo> funTypeParameterWithTwoUpperBounds(): kotlin.Int where P : rendererTest.Bar defined in rendererTest
|
||||
//<P : rendererTest.Foo & rendererTest.Bar> defined in rendererTest.funTypeParameterWithTwoUpperBounds
|
||||
//@kotlin.Deprecated(message = "") public fun deprecatedFun(): kotlin.Unit defined in rendererTest
|
||||
29
compiler/testData/renderer/GlobalProperties.kt
vendored
29
compiler/testData/renderer/GlobalProperties.kt
vendored
@@ -1,29 +0,0 @@
|
||||
package rendererTest
|
||||
|
||||
public val pub = ""
|
||||
|
||||
internal var int: String = ""
|
||||
|
||||
val int2: Int = 5
|
||||
|
||||
private var private = 5
|
||||
|
||||
public val Int.ext: Int
|
||||
get() {}
|
||||
|
||||
@Deprecated("") val deprecatedVal = 5
|
||||
|
||||
public val <T> T.extWithTwoUpperBounds: Int where T : CharSequence, T : Number
|
||||
get() {}
|
||||
|
||||
//package rendererTest
|
||||
//public val pub: kotlin.String defined in rendererTest
|
||||
//internal var int: kotlin.String defined in rendererTest
|
||||
//public val int2: kotlin.Int defined in rendererTest
|
||||
//private var private: kotlin.Int defined in rendererTest
|
||||
//public val kotlin.Int.ext: kotlin.Int defined in rendererTest
|
||||
//public fun kotlin.Int.<get-ext>(): kotlin.Int defined in rendererTest
|
||||
//@kotlin.Deprecated(message = "") public val deprecatedVal: kotlin.Int defined in rendererTest
|
||||
//public val <T : kotlin.CharSequence> T.extWithTwoUpperBounds: kotlin.Int where T : kotlin.Number defined in rendererTest
|
||||
//<T : kotlin.CharSequence & kotlin.Number> defined in rendererTest.extWithTwoUpperBounds
|
||||
//public fun T.<get-extWithTwoUpperBounds>(): kotlin.Int defined in rendererTest
|
||||
@@ -1,30 +0,0 @@
|
||||
interface A {
|
||||
val v: Int
|
||||
public var int: Int
|
||||
private set
|
||||
|
||||
protected fun f(): Int
|
||||
}
|
||||
|
||||
class B : A {
|
||||
override var int: Int = 0
|
||||
get set
|
||||
override fun f(): Int {
|
||||
}
|
||||
override val v: Int = 0
|
||||
get
|
||||
}
|
||||
|
||||
//public interface A defined in root package
|
||||
//public abstract val v: kotlin.Int defined in A
|
||||
//public abstract var int: kotlin.Int defined in A
|
||||
//private abstract fun <set-int>(<set-?>: kotlin.Int): kotlin.Unit defined in A
|
||||
//protected abstract fun f(): kotlin.Int defined in A
|
||||
//public final class B : A defined in root package
|
||||
//public constructor B() defined in B
|
||||
//public open var int: kotlin.Int defined in B
|
||||
//public open fun <get-int>(): kotlin.Int defined in B
|
||||
//private open fun <set-int>(<set-?>: kotlin.Int): kotlin.Unit defined in B
|
||||
//protected open fun f(): kotlin.Int defined in B
|
||||
//public open val v: kotlin.Int defined in B
|
||||
//public open fun <get-v>(): kotlin.Int defined in B
|
||||
37
compiler/testData/renderer/KeywordsInNames.kt
vendored
37
compiler/testData/renderer/KeywordsInNames.kt
vendored
@@ -1,37 +0,0 @@
|
||||
annotation class `true`
|
||||
|
||||
val `val` = 5
|
||||
|
||||
@`true` interface `interface`
|
||||
|
||||
class `class`<`in`>(p: `in`?) {
|
||||
inner class `class`
|
||||
}
|
||||
|
||||
val `is` = `class`<`interface`>(null).`class`()
|
||||
val `in` = `class`<`interface`>(null)
|
||||
|
||||
fun <`in` : `interface`> `interface`.`fun`(`false`: `interface`): `interface` where `in` : Number
|
||||
|
||||
val AS_SAFE = 1
|
||||
val NOT_IN = 2
|
||||
val NOT_IS = 3
|
||||
|
||||
//public final annotation class `true` : kotlin.Annotation defined in root package
|
||||
//public constructor `true`() defined in `true`
|
||||
//public val `val`: kotlin.Int defined in root package
|
||||
//@`true` public interface `interface` defined in root package
|
||||
//public final class `class`<`in`> defined in root package
|
||||
//<`in`> defined in `class`
|
||||
//public constructor `class`<`in`>(p: `in`?) defined in `class`
|
||||
//value-parameter p: `in`? defined in `class`.<init>
|
||||
//public final inner class `class` defined in `class`
|
||||
//public constructor `class`() defined in `class`.`class`
|
||||
//public val `is`: `class`<`interface`>.`class` defined in root package
|
||||
//public val `in`: `class`<`interface`> defined in root package
|
||||
//public fun <`in` : `interface`> `interface`.`fun`(`false`: `interface`): `interface` where `in` : kotlin.Number defined in root package
|
||||
//<`in` : `interface` & kotlin.Number> defined in `fun`
|
||||
//value-parameter `false`: `interface` defined in `fun`
|
||||
//public val AS_SAFE: kotlin.Int defined in root package
|
||||
//public val NOT_IN: kotlin.Int defined in root package
|
||||
//public val NOT_IS: kotlin.Int defined in root package
|
||||
@@ -1,35 +0,0 @@
|
||||
object A1() {
|
||||
constructor(x: Int = "", y: Int) : this() {
|
||||
x + y
|
||||
}
|
||||
}
|
||||
|
||||
object A2 public constructor(private val prop: Int) {
|
||||
constructor(x: Int = "", y: Int) : this(x * y) {
|
||||
x + y
|
||||
}
|
||||
}
|
||||
|
||||
class A3 {
|
||||
companion object B(val prop: Int) {
|
||||
public constructor() : this(2)
|
||||
}
|
||||
}
|
||||
|
||||
//public object A1 defined in root package
|
||||
//private constructor A1() defined in A1
|
||||
//private constructor A1(x: kotlin.Int = ..., y: kotlin.Int) defined in A1
|
||||
//value-parameter x: kotlin.Int = ... defined in A1.<init>
|
||||
//value-parameter y: kotlin.Int defined in A1.<init>
|
||||
//public object A2 defined in root package
|
||||
//public constructor A2(prop: kotlin.Int) defined in A2
|
||||
//value-parameter prop: kotlin.Int defined in A2.<init>
|
||||
//private constructor A2(x: kotlin.Int = ..., y: kotlin.Int) defined in A2
|
||||
//value-parameter x: kotlin.Int = ... defined in A2.<init>
|
||||
//value-parameter y: kotlin.Int defined in A2.<init>
|
||||
//public final class A3 defined in root package
|
||||
//public constructor A3() defined in A3
|
||||
//public companion object B defined in A3
|
||||
//private constructor B(prop: kotlin.Int) defined in A3.B
|
||||
//value-parameter prop: kotlin.Int defined in A3.B.<init>
|
||||
//public constructor B() defined in A3.B
|
||||
19
compiler/testData/renderer/StarProjection.kt
vendored
19
compiler/testData/renderer/StarProjection.kt
vendored
@@ -1,19 +0,0 @@
|
||||
package rendererTest
|
||||
|
||||
class C<T: C<T>> {
|
||||
fun foo(c: C<*>) {}
|
||||
}
|
||||
|
||||
fun foo(c: C<*>) {}
|
||||
fun foo1(c: C<C<*>>) {}
|
||||
|
||||
//package rendererTest
|
||||
//public final class C<T : rendererTest.C<T>> defined in rendererTest
|
||||
//public constructor C<T : rendererTest.C<T>>() defined in rendererTest.C
|
||||
//<T : rendererTest.C<T>> defined in rendererTest.C
|
||||
//public final fun foo(c: rendererTest.C<*>): kotlin.Unit defined in rendererTest.C
|
||||
//value-parameter c: rendererTest.C<*> defined in rendererTest.C.foo
|
||||
//public fun foo(c: rendererTest.C<*>): kotlin.Unit defined in rendererTest
|
||||
//value-parameter c: rendererTest.C<*> defined in rendererTest.foo
|
||||
//public fun foo1(c: rendererTest.C<rendererTest.C<*>>): kotlin.Unit defined in rendererTest
|
||||
//value-parameter c: rendererTest.C<rendererTest.C<*>> defined in rendererTest.foo1
|
||||
@@ -1,23 +0,0 @@
|
||||
interface A1() {
|
||||
constructor(x: Int = "", y: Int) : this() {
|
||||
x + y
|
||||
}
|
||||
}
|
||||
|
||||
interface A2 private constructor(private val prop: Int) {
|
||||
constructor(x: Int = "", y: Int) : this(x * y) {
|
||||
x + y
|
||||
}
|
||||
}
|
||||
|
||||
//public interface A1 defined in root package
|
||||
//public constructor A1() defined in A1
|
||||
//public constructor A1(x: kotlin.Int = ..., y: kotlin.Int) defined in A1
|
||||
//value-parameter x: kotlin.Int = ... defined in A1.<init>
|
||||
//value-parameter y: kotlin.Int defined in A1.<init>
|
||||
//public interface A2 defined in root package
|
||||
//private constructor A2(prop: kotlin.Int) defined in A2
|
||||
//value-parameter prop: kotlin.Int defined in A2.<init>
|
||||
//public constructor A2(x: kotlin.Int = ..., y: kotlin.Int) defined in A2
|
||||
//value-parameter x: kotlin.Int = ... defined in A2.<init>
|
||||
//value-parameter y: kotlin.Int defined in A2.<init>
|
||||
49
compiler/testData/renderer/TypeAnnotations.kt
vendored
49
compiler/testData/renderer/TypeAnnotations.kt
vendored
@@ -1,49 +0,0 @@
|
||||
annotation class Ann1(val p1: Int, val p2: Int)
|
||||
annotation class Ann2
|
||||
annotation class Ann3(val p: Int)
|
||||
annotation class Ann4
|
||||
annotation class Ann5
|
||||
annotation class Ann6
|
||||
annotation class Ann7(val p: Boolean = false)
|
||||
|
||||
|
||||
var v1: @Ann1(1, 2) String
|
||||
var v2: @Ann2 Int?
|
||||
var v3: @Ann3(0) (String, Int) -> Char
|
||||
var v4: @Ann4 X // currently annotations are lost for error types
|
||||
var v5: @Ann5() (String.() -> Unit)
|
||||
var v6: @Ann6() (() -> Unit)?
|
||||
fun f1(calculation: @Ann7 () -> Any)
|
||||
fun f2(calculation: @Ann7() () -> Any)
|
||||
fun f3(calculation: @Ann7(true) () -> Any)
|
||||
|
||||
//public final annotation class Ann1 : kotlin.Annotation defined in root package
|
||||
//public constructor Ann1(p1: kotlin.Int, p2: kotlin.Int) defined in Ann1
|
||||
//value-parameter p1: kotlin.Int defined in Ann1.<init>
|
||||
//value-parameter p2: kotlin.Int defined in Ann1.<init>
|
||||
//public final annotation class Ann2 : kotlin.Annotation defined in root package
|
||||
//public constructor Ann2() defined in Ann2
|
||||
//public final annotation class Ann3 : kotlin.Annotation defined in root package
|
||||
//public constructor Ann3(p: kotlin.Int) defined in Ann3
|
||||
//value-parameter p: kotlin.Int defined in Ann3.<init>
|
||||
//public final annotation class Ann4 : kotlin.Annotation defined in root package
|
||||
//public constructor Ann4() defined in Ann4
|
||||
//public final annotation class Ann5 : kotlin.Annotation defined in root package
|
||||
//public constructor Ann5() defined in Ann5
|
||||
//public final annotation class Ann6 : kotlin.Annotation defined in root package
|
||||
//public constructor Ann6() defined in Ann6
|
||||
//public final annotation class Ann7 : kotlin.Annotation defined in root package
|
||||
//public constructor Ann7(p: kotlin.Boolean = ...) defined in Ann7
|
||||
//value-parameter p: kotlin.Boolean = ... defined in Ann7.<init>
|
||||
//public var v1: @Ann1(p1 = 1, p2 = 2) kotlin.String defined in root package
|
||||
//public var v2: @Ann2 kotlin.Int? defined in root package
|
||||
//public var v3: @Ann3(p = 0) (kotlin.String, kotlin.Int) -> kotlin.Char defined in root package
|
||||
//public var v4: [ERROR : X] defined in root package
|
||||
//public var v5: @Ann5() (kotlin.String.() -> kotlin.Unit) defined in root package
|
||||
//public var v6: @Ann6() (() -> kotlin.Unit)? defined in root package
|
||||
//public fun f1(calculation: @Ann7 () -> kotlin.Any): kotlin.Unit defined in root package
|
||||
//value-parameter calculation: @Ann7 () -> kotlin.Any defined in f1
|
||||
//public fun f2(calculation: @Ann7 () -> kotlin.Any): kotlin.Unit defined in root package
|
||||
//value-parameter calculation: @Ann7 () -> kotlin.Any defined in f2
|
||||
//public fun f3(calculation: @Ann7(p = true) () -> kotlin.Any): kotlin.Unit defined in root package
|
||||
//value-parameter calculation: @Ann7(p = true) () -> kotlin.Any defined in f3
|
||||
5
compiler/testData/renderer/UnitType.kt
vendored
5
compiler/testData/renderer/UnitType.kt
vendored
@@ -1,5 +0,0 @@
|
||||
var v1: Unit
|
||||
var v2: Unit?
|
||||
|
||||
//public var v1: kotlin.Unit defined in root package
|
||||
//public var v2: kotlin.Unit? defined in root package
|
||||
@@ -1,136 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.renderer
|
||||
|
||||
import com.intellij.openapi.editor.impl.DocumentImpl
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.container.ComponentProvider
|
||||
import org.jetbrains.kotlin.container.get
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.CompilerEnvironment
|
||||
import org.jetbrains.kotlin.resolve.TargetEnvironment
|
||||
import org.jetbrains.kotlin.resolve.lazy.JvmResolveUtil
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.KotlinTestWithEnvironment
|
||||
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
abstract class AbstractDescriptorRendererTest : KotlinTestWithEnvironment() {
|
||||
protected open fun getDescriptor(declaration: KtDeclaration, container: ComponentProvider): DeclarationDescriptor {
|
||||
return container.get<ResolveSession>().resolveToDescriptor(declaration)
|
||||
}
|
||||
|
||||
protected open val targetEnvironment: TargetEnvironment
|
||||
get() = CompilerEnvironment
|
||||
|
||||
fun doTest(path: String) {
|
||||
val fileText = FileUtil.loadFile(File(path), true)
|
||||
val psiFile = KtPsiFactory(project).createFile(fileText)
|
||||
|
||||
val container = JvmResolveUtil.createContainer(environment, listOf(psiFile), targetEnvironment)
|
||||
val module = container.get<ModuleDescriptor>()
|
||||
|
||||
val descriptors = ArrayList<DeclarationDescriptor>()
|
||||
|
||||
psiFile.accept(object : KtVisitorVoid() {
|
||||
override fun visitKtFile(file: KtFile) {
|
||||
val fqName = file.packageFqName
|
||||
if (!fqName.isRoot) {
|
||||
descriptors.add(module.getPackage(fqName))
|
||||
}
|
||||
file.acceptChildren(this)
|
||||
}
|
||||
|
||||
override fun visitParameter(parameter: KtParameter) {
|
||||
val declaringElement = parameter.parent.parent
|
||||
when (declaringElement) {
|
||||
is KtFunctionType -> return
|
||||
is KtNamedFunction ->
|
||||
addCorrespondingParameterDescriptor(getDescriptor(declaringElement, container) as FunctionDescriptor, parameter)
|
||||
is KtPrimaryConstructor -> {
|
||||
val ktClassOrObject: KtClassOrObject = declaringElement.getContainingClassOrObject()
|
||||
val classDescriptor = getDescriptor(ktClassOrObject, container) as ClassDescriptor
|
||||
addCorrespondingParameterDescriptor(classDescriptor.unsubstitutedPrimaryConstructor!!, parameter)
|
||||
}
|
||||
else -> super.visitParameter(parameter)
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitPropertyAccessor(accessor: KtPropertyAccessor) {
|
||||
val property = accessor.property
|
||||
val propertyDescriptor = getDescriptor(property, container) as PropertyDescriptor
|
||||
if (accessor.isGetter) {
|
||||
descriptors.add(propertyDescriptor.getter!!)
|
||||
}
|
||||
else {
|
||||
descriptors.add(propertyDescriptor.setter!!)
|
||||
}
|
||||
accessor.acceptChildren(this)
|
||||
}
|
||||
|
||||
override fun visitAnonymousInitializer(initializer: KtAnonymousInitializer) {
|
||||
initializer.acceptChildren(this)
|
||||
}
|
||||
|
||||
override fun visitDeclaration(element: KtDeclaration) {
|
||||
val descriptor = getDescriptor(element, container)
|
||||
descriptors.add(descriptor)
|
||||
if (descriptor is ClassDescriptor) {
|
||||
// if class has primary constructor then we visit it later, otherwise add it artificially
|
||||
if (element !is KtClassOrObject || !element.hasExplicitPrimaryConstructor()) {
|
||||
if (descriptor.unsubstitutedPrimaryConstructor != null) {
|
||||
descriptors.add(descriptor.unsubstitutedPrimaryConstructor!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
element.acceptChildren(this)
|
||||
}
|
||||
|
||||
override fun visitKtElement(element: KtElement) {
|
||||
element.acceptChildren(this)
|
||||
}
|
||||
|
||||
private fun addCorrespondingParameterDescriptor(functionDescriptor: FunctionDescriptor, parameter: KtParameter) {
|
||||
for (valueParameterDescriptor in functionDescriptor.valueParameters) {
|
||||
if (valueParameterDescriptor.name == parameter.nameAsName) {
|
||||
descriptors.add(valueParameterDescriptor)
|
||||
}
|
||||
}
|
||||
parameter.acceptChildren(this)
|
||||
}
|
||||
})
|
||||
|
||||
val renderer = DescriptorRenderer.withOptions {
|
||||
classifierNamePolicy = ClassifierNamePolicy.FULLY_QUALIFIED
|
||||
modifiers = DescriptorRendererModifier.ALL
|
||||
annotationArgumentsRenderingPolicy = AnnotationArgumentsRenderingPolicy.UNLESS_EMPTY
|
||||
}
|
||||
val renderedDescriptors = descriptors.map { renderer.render(it) }.joinToString(separator = "\n")
|
||||
|
||||
val document = DocumentImpl(psiFile.text)
|
||||
KtUsefulTestCase.assertSameLines(KotlinTestUtils.getLastCommentedLines(document), renderedDescriptors)
|
||||
}
|
||||
|
||||
override fun createEnvironment(): KotlinCoreEnvironment {
|
||||
return createEnvironmentWithMockJdk(ConfigurationKind.JDK_ONLY)
|
||||
}
|
||||
}
|
||||
@@ -43,8 +43,6 @@ import org.jetbrains.kotlin.lexer.kotlin.AbstractKotlinLexerTest
|
||||
import org.jetbrains.kotlin.modules.xml.AbstractModuleXmlParserTest
|
||||
import org.jetbrains.kotlin.multiplatform.AbstractMultiPlatformIntegrationTest
|
||||
import org.jetbrains.kotlin.parsing.AbstractParsingTest
|
||||
import org.jetbrains.kotlin.renderer.AbstractDescriptorRendererTest
|
||||
import org.jetbrains.kotlin.renderer.AbstractFunctionDescriptorInExpressionRendererTest
|
||||
import org.jetbrains.kotlin.repl.AbstractReplInterpreterTest
|
||||
import org.jetbrains.kotlin.resolve.AbstractResolveTest
|
||||
import org.jetbrains.kotlin.resolve.annotation.AbstractAnnotationParameterTest
|
||||
@@ -267,14 +265,6 @@ fun generateJUnit3CompilerTests(args: Array<String>) {
|
||||
model("compileKotlinAgainstKotlinJdk15", targetBackend = TargetBackend.JVM_IR)
|
||||
}
|
||||
|
||||
testClass<AbstractDescriptorRendererTest> {
|
||||
model("renderer")
|
||||
}
|
||||
|
||||
testClass<AbstractFunctionDescriptorInExpressionRendererTest> {
|
||||
model("renderFunctionDescriptorInExpression")
|
||||
}
|
||||
|
||||
testClass<AbstractModuleXmlParserTest> {
|
||||
model("modules.xml", extension = "xml")
|
||||
}
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.renderer;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/renderer")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class DescriptorRendererTestGenerated extends AbstractDescriptorRendererTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInRenderer() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/renderer"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("Classes.kt")
|
||||
public void testClasses() throws Exception {
|
||||
runTest("compiler/testData/renderer/Classes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("Enum.kt")
|
||||
public void testEnum() throws Exception {
|
||||
runTest("compiler/testData/renderer/Enum.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ErrorType.kt")
|
||||
public void testErrorType() throws Exception {
|
||||
runTest("compiler/testData/renderer/ErrorType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("FunctionTypes.kt")
|
||||
public void testFunctionTypes() throws Exception {
|
||||
runTest("compiler/testData/renderer/FunctionTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("FunctionTypesInSignature.kt")
|
||||
public void testFunctionTypesInSignature() throws Exception {
|
||||
runTest("compiler/testData/renderer/FunctionTypesInSignature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("GlobalFunctions.kt")
|
||||
public void testGlobalFunctions() throws Exception {
|
||||
runTest("compiler/testData/renderer/GlobalFunctions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("GlobalProperties.kt")
|
||||
public void testGlobalProperties() throws Exception {
|
||||
runTest("compiler/testData/renderer/GlobalProperties.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InheritedMembersVisibility.kt")
|
||||
public void testInheritedMembersVisibility() throws Exception {
|
||||
runTest("compiler/testData/renderer/InheritedMembersVisibility.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("KeywordsInNames.kt")
|
||||
public void testKeywordsInNames() throws Exception {
|
||||
runTest("compiler/testData/renderer/KeywordsInNames.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ObjectWithConstructor.kt")
|
||||
public void testObjectWithConstructor() throws Exception {
|
||||
runTest("compiler/testData/renderer/ObjectWithConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("StarProjection.kt")
|
||||
public void testStarProjection() throws Exception {
|
||||
runTest("compiler/testData/renderer/StarProjection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TraitWithConstructor.kt")
|
||||
public void testTraitWithConstructor() throws Exception {
|
||||
runTest("compiler/testData/renderer/TraitWithConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TypeAnnotations.kt")
|
||||
public void testTypeAnnotations() throws Exception {
|
||||
runTest("compiler/testData/renderer/TypeAnnotations.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("UnitType.kt")
|
||||
public void testUnitType() throws Exception {
|
||||
runTest("compiler/testData/renderer/UnitType.kt");
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.renderer;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/renderFunctionDescriptorInExpression")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class FunctionDescriptorInExpressionRendererTestGenerated extends AbstractFunctionDescriptorInExpressionRendererTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInRenderFunctionDescriptorInExpression() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/renderFunctionDescriptorInExpression"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("basicFunExpr.kt")
|
||||
public void testBasicFunExpr() throws Exception {
|
||||
runTest("compiler/testData/renderFunctionDescriptorInExpression/basicFunExpr.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("basicFunExprArgs.kt")
|
||||
public void testBasicFunExprArgs() throws Exception {
|
||||
runTest("compiler/testData/renderFunctionDescriptorInExpression/basicFunExprArgs.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("basicLambda.kt")
|
||||
public void testBasicLambda() throws Exception {
|
||||
runTest("compiler/testData/renderFunctionDescriptorInExpression/basicLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("labeledLambda.kt")
|
||||
public void testLabeledLambda() throws Exception {
|
||||
runTest("compiler/testData/renderFunctionDescriptorInExpression/labeledLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("parenthesizedFunExpr.kt")
|
||||
public void testParenthesizedFunExpr() throws Exception {
|
||||
runTest("compiler/testData/renderFunctionDescriptorInExpression/parenthesizedFunExpr.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("parenthesizedLambda.kt")
|
||||
public void testParenthesizedLambda() throws Exception {
|
||||
runTest("compiler/testData/renderFunctionDescriptorInExpression/parenthesizedLambda.kt");
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.renderer
|
||||
|
||||
import com.intellij.openapi.editor.impl.DocumentImpl
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.impl.FunctionExpressionDescriptor
|
||||
import org.jetbrains.kotlin.psi.KtLambdaExpression
|
||||
import org.jetbrains.kotlin.psi.KtNamedFunction
|
||||
import org.jetbrains.kotlin.psi.KtPsiFactory
|
||||
import org.jetbrains.kotlin.psi.KtTreeVisitorVoid
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.lazy.JvmResolveUtil
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.KotlinTestWithEnvironment
|
||||
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractFunctionDescriptorInExpressionRendererTest : KotlinTestWithEnvironment() {
|
||||
fun doTest(path: String) {
|
||||
val fileText = FileUtil.loadFile(File(path), true)
|
||||
val file = KtPsiFactory(project).createFile(fileText)
|
||||
val bindingContext = JvmResolveUtil.analyze(file, environment).bindingContext
|
||||
|
||||
val descriptors = arrayListOf<DeclarationDescriptor>()
|
||||
|
||||
file.accept(object : KtTreeVisitorVoid() {
|
||||
override fun visitNamedFunction(function: KtNamedFunction) {
|
||||
function.acceptChildren(this)
|
||||
descriptors.addIfNotNull(bindingContext.get(BindingContext.FUNCTION, function) as? FunctionExpressionDescriptor)
|
||||
}
|
||||
override fun visitLambdaExpression(lambdaExpression: KtLambdaExpression) {
|
||||
lambdaExpression.acceptChildren(this)
|
||||
descriptors.add(bindingContext.get(BindingContext.FUNCTION, lambdaExpression.functionLiteral)!!)
|
||||
}
|
||||
})
|
||||
|
||||
val renderer = DescriptorRenderer.withOptions {
|
||||
classifierNamePolicy = ClassifierNamePolicy.FULLY_QUALIFIED
|
||||
modifiers = DescriptorRendererModifier.ALL
|
||||
verbose = true
|
||||
annotationArgumentsRenderingPolicy = AnnotationArgumentsRenderingPolicy.UNLESS_EMPTY
|
||||
}
|
||||
val renderedDescriptors = descriptors.map { renderer.render(it) }.joinToString(separator = "\n")
|
||||
|
||||
val document = DocumentImpl(file.text)
|
||||
KtUsefulTestCase.assertSameLines(KotlinTestUtils.getLastCommentedLines(document), renderedDescriptors.toString())
|
||||
}
|
||||
|
||||
override fun createEnvironment(): KotlinCoreEnvironment {
|
||||
return createEnvironmentWithMockJdk(ConfigurationKind.JDK_ONLY)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user