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,22 @@
package
public const val ONE: kotlin.Int = 1
public val two: kotlin.Int = 2
@Foo(a = {1}, b = {"/"}, c = {1.0.toFloat()}) public fun test1(): kotlin.Unit
@Foo(a = {}, b = {}, c = {}) public fun test2(): kotlin.Unit
@Foo public fun test3(): kotlin.Unit
@Foo(a = {1}, b = {""}, c = {1.0.toFloat()}) public fun test4(): kotlin.Unit
@Foo(a = {3}, b = {"Hello, Kotlin"}, c = {Infinity.toFloat()}) public fun test5(): kotlin.Unit
@Foo(a = {1}, b = {}, c = {}) public fun test6(): kotlin.Unit
@Foo(a = {3}, b = {}, c = {}) public fun test7(): kotlin.Unit
@Foo(a = {2}, b = {}, c = {}) public fun test8(): kotlin.Unit
public final annotation class Foo : kotlin.Annotation {
public constructor Foo(/*0*/ a: kotlin.IntArray, /*1*/ b: kotlin.Array<kotlin.String>, /*2*/ c: kotlin.FloatArray)
public final val a: kotlin.IntArray
public final val b: kotlin.Array<kotlin.String>
public final val c: kotlin.FloatArray
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
}