Apply constant folding for collection literals to use in annotations

Currently this is achieved with several hacks:
- Postpone computation of argument type info when there is no candidate resolver. We have to do this, because we don't have expected type and therefore we could write wrong information to trace
- Presume that for annotation calls there is only one candidate resolver and then resolve arguments with expected type (see `getArgumentTypeInfo`), otherwise because of quadratic complexity of the algorithm resolve would be slow
This commit is contained in:
Mikhail Zarechenskiy
2017-03-20 16:31:02 +03:00
parent c85f6e7d0e
commit e49b2811ec
12 changed files with 321 additions and 19 deletions
@@ -0,0 +1,32 @@
package
@Foo(a = {}) public fun test1(): kotlin.Unit
@Foo(a = {kotlin.Int::class, kotlin.String::class}) public fun test2(): kotlin.Unit
@Foo(a = {kotlin.Array<*>::class}) public fun test3(): kotlin.Unit
@Foo(a = {Gen<kotlin.Int>::class}) public fun test4(): kotlin.Unit
@Foo public fun test5(): kotlin.Unit
@Foo public fun test6(): kotlin.Unit
@Bar public fun test7(): kotlin.Unit
public final annotation class Bar : kotlin.Annotation {
public constructor Bar(/*0*/ a: kotlin.Array<kotlin.reflect.KClass<*>> = ...)
public final val a: kotlin.Array<kotlin.reflect.KClass<*>>
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final annotation class Foo : kotlin.Annotation {
public constructor Foo(/*0*/ a: kotlin.Array<kotlin.reflect.KClass<*>> = ...)
public final val a: kotlin.Array<kotlin.reflect.KClass<*>>
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Gen</*0*/ T> {
public constructor Gen</*0*/ T>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}