Split CompileTimeConstant into two entities

1. ConstantValue
	* just holds some value and its type
	* implementations for concrete constants
2. CompileTimeConstant
	* is only produced by ConstantExpressionEvaluator
	* has additional flags (canBeUsedInAnnotation etc)
	* has two implementations TypedCompileTimeConstant containing a constant value
		and IntegerValueConstant which does not have exact type
	* can be converted to ConstantValue

Adjustt usages to use ConstantValue if flags are not needed
Add tests for some uncovered cases
This commit is contained in:
Pavel V. Talanov
2015-07-07 14:56:19 +03:00
parent 155f00578d
commit c313887641
134 changed files with 791 additions and 907 deletions
@@ -8,4 +8,6 @@ class Foo {
public static final boolean bool = true;
public static final char c = 'c';
public static final String str = "str";
public static final int charAsInt = '3';
public static final char intAsChar = 3;
}
@@ -1,4 +1,4 @@
Ann(Foo.i, Foo.s, Foo.f, Foo.d, Foo.l, Foo.b, Foo.bool, Foo.c, Foo.str) class MyClass
Ann(Foo.i, Foo.s, Foo.f, Foo.d, Foo.l, Foo.b, Foo.bool, Foo.c, Foo.str, Foo.charAsInt, Foo.intAsChar) class MyClass
fun box(): String {
val ann = javaClass<MyClass>().getAnnotation(javaClass<Ann>())
@@ -12,6 +12,8 @@ fun box(): String {
if (!ann.bool) return "fail: annotation parameter i should be true, but was ${ann.i}"
if (ann.c != 'c') return "fail: annotation parameter i should be c, but was ${ann.i}"
if (ann.str != "str") return "fail: annotation parameter i should be str, but was ${ann.i}"
if (ann.i2 != '3'.toInt()) return "fail: annotation parameter i2 should be ${'3'.toInt()}, but was ${ann.i}"
if (ann.c2 != 3.toChar()) return "fail: annotation parameter c2 should be 3, but was ${ann.i}"
return "OK"
}
@@ -24,5 +26,7 @@ annotation(retention = AnnotationRetention.RUNTIME) class Ann(
val b: Byte,
val bool: Boolean,
val c: Char,
val str: String
val str: String,
val i2: Int,
val c2: Char
)
@@ -1,6 +1,6 @@
package
internal fun foo(): @[My(x = IntegerValueType(42))] kotlin.Int
internal fun foo(): @[My(x = 42)] kotlin.Int
kotlin.annotation.target(allowedTargets = {AnnotationTarget.TYPE}) kotlin.annotation.annotation() internal final class My : kotlin.Annotation {
public constructor My(/*0*/ x: kotlin.Int)
@@ -12,7 +12,7 @@ package test {
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
test.A(a = IntegerValueType(12), c = "Hello") internal object SomeObject {
test.A(a = 12, c = "Hello") internal object SomeObject {
private constructor SomeObject()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -2,10 +2,10 @@ package
my() internal fun foo(): kotlin.Unit
my1() internal fun foo2(): kotlin.Unit
my1(i = IntegerValueType(2)) internal fun foo3(): kotlin.Unit
my1(i = 2) internal fun foo3(): kotlin.Unit
my2() internal fun foo4(): kotlin.Unit
my2() internal fun foo41(): kotlin.Unit
my2(i = IntegerValueType(2)) internal fun foo42(): kotlin.Unit
my2(i = 2) internal fun foo42(): kotlin.Unit
kotlin.annotation.annotation() internal final class my : kotlin.Annotation {
public constructor my()
@@ -1,7 +1,7 @@
package
Ann2(a = Ann1(a = IntegerValueType(1))) internal val a: kotlin.Int = 1
Ann2(a = Ann1(a = IntegerValueType(1))) internal val c: kotlin.Int = 2
Ann2(a = Ann1(a = 1)) internal val a: kotlin.Int = 1
Ann2(a = Ann1(a = 1)) internal val c: kotlin.Int = 2
internal fun bar(/*0*/ a: Ann = ...): kotlin.Unit
internal fun foo(): kotlin.Unit
internal fun </*0*/ T> javaClass(): java.lang.Class<T>
@@ -1,6 +1,6 @@
package
RecursivelyAnnotated(x = IntegerValueType(1)) kotlin.annotation.annotation() internal final class RecursivelyAnnotated : kotlin.Annotation {
RecursivelyAnnotated(x = 1) kotlin.annotation.annotation() internal final class RecursivelyAnnotated : kotlin.Annotation {
public constructor RecursivelyAnnotated(/*0*/ x: kotlin.Int)
internal final val x: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -1,8 +1,8 @@
package
kotlin.annotation.annotation() internal final class RecursivelyAnnotated : kotlin.Annotation {
public constructor RecursivelyAnnotated(/*0*/ RecursivelyAnnotated(x = IntegerValueType(1)) x: kotlin.Int)
RecursivelyAnnotated(x = IntegerValueType(1)) internal final val x: kotlin.Int
public constructor RecursivelyAnnotated(/*0*/ RecursivelyAnnotated(x = 1) x: kotlin.Int)
RecursivelyAnnotated(x = 1) internal final val x: kotlin.Int
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
@@ -1,8 +1,8 @@
package
kotlin.annotation.target(allowedTargets = {AnnotationTarget.TYPE}) kotlin.annotation.annotation() internal final class RecursivelyAnnotated : kotlin.Annotation {
public constructor RecursivelyAnnotated(/*0*/ x: @[RecursivelyAnnotated(x = IntegerValueType(1))] kotlin.Int)
internal final val x: @[RecursivelyAnnotated(x = IntegerValueType(1))] kotlin.Int
public constructor RecursivelyAnnotated(/*0*/ x: @[RecursivelyAnnotated(x = 1)] kotlin.Int)
internal final val x: @[RecursivelyAnnotated(x = 1)] kotlin.Int
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
@@ -1,8 +1,8 @@
package
kotlin.annotation.annotation() internal final class RecursivelyAnnotated : kotlin.Annotation {
public constructor RecursivelyAnnotated(/*0*/ RecursivelyAnnotated(x = IntegerValueType(1)) x: kotlin.Int)
RecursivelyAnnotated(x = IntegerValueType(1)) internal final val x: kotlin.Int
public constructor RecursivelyAnnotated(/*0*/ RecursivelyAnnotated(x = 1) x: kotlin.Int)
RecursivelyAnnotated(x = 1) internal final val x: kotlin.Int
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
@@ -1,8 +1,8 @@
package
internal final class RecursivelyAnnotated {
public constructor RecursivelyAnnotated(/*0*/ RecursivelyAnnotated(x = IntegerValueType(1)) x: kotlin.Int)
RecursivelyAnnotated(x = IntegerValueType(1)) internal final val x: kotlin.Int
public constructor RecursivelyAnnotated(/*0*/ RecursivelyAnnotated(x = 1) x: kotlin.Int)
RecursivelyAnnotated(x = 1) internal final val x: kotlin.Int
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
@@ -11,7 +11,7 @@ package test {
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
test.BadAnnotation(s = IntegerValueType(1)) internal object SomeObject {
test.BadAnnotation(s = 1) internal object SomeObject {
private constructor SomeObject()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -1,11 +1,11 @@
package
Ann(x = IntegerValueType(1)) Ann(x = IntegerValueType(2)) Ann(x = IntegerValueType(3)) private final class A {
Ann(x = 1) Ann(x = 2) Ann(x = 3) private final class A {
Ann() public constructor A()
Ann() internal final val x: kotlin.Int = 1
internal final fun bar(/*0*/ x: @[Ann(x = IntegerValueType(1)) Ann(x = IntegerValueType(2)) Ann(x = IntegerValueType(3))] kotlin.Int): kotlin.Unit
internal final fun bar(/*0*/ x: @[Ann(x = 1) Ann(x = 2) Ann(x = 3)] kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
Ann(x = IntegerValueType(5)) internal final fun foo(): kotlin.Unit
Ann(x = 5) internal final fun foo(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -9,7 +9,7 @@ internal final class A {
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
internal final inner class B {
Ann(x = IntegerValueType(2)) public constructor B(/*0*/ y: kotlin.Int)
Ann(x = 2) public constructor B(/*0*/ y: kotlin.Int)
internal final val y: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -1,6 +1,6 @@
package
A(x = IntegerValueType(1), y = "2") internal fun test(): kotlin.Unit
A(x = 1, y = "2") internal fun test(): kotlin.Unit
public final class A : kotlin.Annotation {
public constructor A(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.String)
@@ -3,7 +3,7 @@ package
internal final class A {
Ann1() public constructor A()
Ann2() public constructor A(/*0*/ x1: kotlin.Int)
Ann2(x = IntegerValueType(2)) public constructor A(/*0*/ x1: kotlin.Int, /*1*/ x2: kotlin.Int)
Ann2(x = 2) public constructor A(/*0*/ x1: kotlin.Int, /*1*/ x2: kotlin.Int)
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
@@ -14,7 +14,7 @@ public final class A : kotlin.Annotation {
public abstract fun value(): kotlin.String
}
A(arg = IntegerValueType(1), value = "a") internal final class MyClass {
A(arg = 1, value = "a") internal final class MyClass {
public constructor MyClass()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -29,7 +29,7 @@ Ann(i = {}) Ann(i = {1}) Ann(i = {}) Ann(i = {1}) Ann(i = {{1}}) internal final
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
AnnAnn(i = {Ann(i = {IntegerValueType(1)})}) AnnAnn(i = {}) internal final class TestAnn {
AnnAnn(i = {Ann(i = {1})}) AnnAnn(i = {}) internal final class TestAnn {
public constructor TestAnn()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -29,7 +29,7 @@ Ann(i = {}) Ann(i = {1}) Ann(i = {}) Ann(i = {1}) Ann(i = {}) Ann(i = {1}) Ann(i
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
AnnAnn(i = {Ann(i = {IntegerValueType(1)})}) AnnAnn(i = {}) internal final class TestAnn {
AnnAnn(i = {Ann(i = {1})}) AnnAnn(i = {}) internal final class TestAnn {
public constructor TestAnn()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -1,12 +1,12 @@
package
A(value = {"1", "2", "3"}, y = IntegerValueType(1)) internal fun test1(): kotlin.Unit
A(value = {"4"}, y = IntegerValueType(2)) internal fun test2(): kotlin.Unit
A(value = {{"5", "6"}, "7"}, y = IntegerValueType(3)) internal fun test3(): kotlin.Unit
A(value = {"1", "2", "3"}, x = kotlin.String::class, y = IntegerValueType(4)) internal fun test4(): kotlin.Unit
A(value = {"4"}, y = IntegerValueType(5)) internal fun test5(): kotlin.Unit
A(value = {{"5", "6"}, "7"}, x = kotlin.Any::class, y = IntegerValueType(6)) internal fun test6(): kotlin.Unit
A(value = {}, y = IntegerValueType(7)) internal fun test7(): kotlin.Unit
A(value = {"1", "2", "3"}, y = 1) internal fun test1(): kotlin.Unit
A(value = {"4"}, y = 2) internal fun test2(): kotlin.Unit
A(value = {{"5", "6"}, "7"}, y = 3) internal fun test3(): kotlin.Unit
A(value = {"1", "2", "3"}, x = kotlin.String::class, y = 4) internal fun test4(): kotlin.Unit
A(value = {"4"}, y = 5) internal fun test5(): kotlin.Unit
A(value = {{"5", "6"}, "7"}, x = kotlin.Any::class, y = 6) internal fun test6(): kotlin.Unit
A(value = {}, y = 7) internal fun test7(): kotlin.Unit
A(value = {"8", "9", "10"}) internal fun test8(): kotlin.Unit
public final class A : kotlin.Annotation {
@@ -1,16 +1,16 @@
package
A(value = {"1", "2", "3"}) internal fun test1(): kotlin.Unit
A(value = {"5", "6"}, x = kotlin.Any::class, y = IntegerValueType(3)) internal fun test10(): kotlin.Unit
A(value = {"5", "6", "7"}, x = kotlin.Any::class, y = IntegerValueType(3)) internal fun test11(): kotlin.Unit
A(value = {"5", "6"}, x = kotlin.Any::class, y = 3) internal fun test10(): kotlin.Unit
A(value = {"5", "6", "7"}, x = kotlin.Any::class, y = 3) internal fun test11(): kotlin.Unit
A(value = {"4"}) internal fun test2(): kotlin.Unit
A(value = {{"5", "6"}, "7"}) internal fun test3(): kotlin.Unit
A(value = {"1", "2", "3"}, x = kotlin.String::class) internal fun test4(): kotlin.Unit
A(value = {"4"}, y = IntegerValueType(2)) internal fun test5(): kotlin.Unit
A(value = {{"5", "6"}, "7"}, x = kotlin.Any::class, y = IntegerValueType(3)) internal fun test6(): kotlin.Unit
A(value = {"4"}, y = 2) internal fun test5(): kotlin.Unit
A(value = {{"5", "6"}, "7"}, x = kotlin.Any::class, y = 3) internal fun test6(): kotlin.Unit
A(value = {}) internal fun test7(): kotlin.Unit
A(value = {}) internal fun test8(): kotlin.Unit
A(value = {}, x = kotlin.Any::class, y = IntegerValueType(3)) internal fun test9(): kotlin.Unit
A(value = {}, x = kotlin.Any::class, y = 3) internal fun test9(): kotlin.Unit
public final class A : kotlin.Annotation {
public constructor A(/*0*/ vararg value: kotlin.String /*kotlin.Array<out kotlin.String>*/, /*1*/ x: kotlin.reflect.KClass<*> = ..., /*2*/ y: kotlin.Int = ...)
@@ -1,6 +1,6 @@
package
A(value = {IntegerValueType(1), "b"}) internal fun test(): kotlin.Unit
A(value = {1, "b"}) internal fun test(): kotlin.Unit
public final class A : kotlin.Annotation {
public constructor A(/*0*/ vararg value: kotlin.String /*kotlin.Array<out kotlin.String>*/)
@@ -1,6 +1,6 @@
package
B(args = {IntegerValueType(1), "b"}) internal fun test(): kotlin.Unit
B(args = {1, "b"}) internal fun test(): kotlin.Unit
kotlin.annotation.annotation() internal final class B : kotlin.Annotation {
public constructor B(/*0*/ vararg args: kotlin.String /*kotlin.Array<out kotlin.String>*/)
@@ -24,14 +24,14 @@ public final class B : kotlin.Annotation {
public abstract fun y(): kotlin.Int
}
A(arg = kotlin.String::class, b = B(y = IntegerValueType(1))) internal final class MyClass1 {
A(arg = kotlin.String::class, b = B(y = 1)) internal final class MyClass1 {
public constructor MyClass1()
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
}
A(b = B(y = IntegerValueType(3))) internal final class MyClass2 {
A(b = B(y = 3)) internal final class MyClass2 {
public constructor MyClass2()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -18,7 +18,7 @@ A(arg = kotlin.String::class) internal final class MyClass1 {
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
A(arg = kotlin.String::class, x = IntegerValueType(2)) internal final class MyClass2 {
A(arg = kotlin.String::class, x = 2) internal final class MyClass2 {
public constructor MyClass2()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -11,14 +11,14 @@ public final class A : kotlin.Annotation {
public abstract fun x(): kotlin.Int
}
A(arg = kotlin.String::class, x = IntegerValueType(4)) internal final class MyClass2 {
A(arg = kotlin.String::class, x = 4) internal final class MyClass2 {
public constructor MyClass2()
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
}
A(x = IntegerValueType(5)) internal final class MyClass3 {
A(x = 5) internal final class MyClass3 {
public constructor MyClass3()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -25,14 +25,14 @@ A(value = kotlin.String::class) internal final class MyClass2 {
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
A(value = kotlin.String::class, x = IntegerValueType(2)) internal final class MyClass3 {
A(value = kotlin.String::class, x = 2) internal final class MyClass3 {
public constructor MyClass3()
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
}
A(value = kotlin.String::class, x = IntegerValueType(4)) internal final class MyClass4 {
A(value = kotlin.String::class, x = 4) internal final class MyClass4 {
public constructor MyClass4()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -11,21 +11,21 @@ public final class A : kotlin.Annotation {
public abstract fun x(): kotlin.Int
}
A(value = kotlin.String::class, x = IntegerValueType(2)) internal final class MyClass1 {
A(value = kotlin.String::class, x = 2) internal final class MyClass1 {
public constructor MyClass1()
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
}
A(value = kotlin.String::class, x = IntegerValueType(4)) internal final class MyClass2 {
A(value = kotlin.String::class, x = 4) internal final class MyClass2 {
public constructor MyClass2()
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
}
A(x = IntegerValueType(5)) internal final class MyClass3 {
A(x = 5) internal final class MyClass3 {
public constructor MyClass3()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -1,8 +1,8 @@
package
Ann(value = "a", x = IntegerValueType(1), y = 1.0.toDouble()) internal fun foo1(): kotlin.Unit
Ann(value = "b", x = IntegerValueType(2), y = 2.0.toDouble()) internal fun foo2(): kotlin.Unit
Ann(value = "c", x = IntegerValueType(3), y = 2.0.toDouble()) internal fun foo3(): kotlin.Unit
Ann(value = "a", x = 1, y = 1.0.toDouble()) internal fun foo1(): kotlin.Unit
Ann(value = "b", x = 2, y = 2.0.toDouble()) internal fun foo2(): kotlin.Unit
Ann(value = "c", x = 3, y = 2.0.toDouble()) internal fun foo3(): kotlin.Unit
kotlin.annotation.annotation() internal final class Ann : kotlin.Annotation {
public constructor Ann(/*0*/ x: kotlin.Int, /*1*/ value: kotlin.String, /*2*/ y: kotlin.Double)
@@ -1,9 +1,9 @@
package
A(a = IntegerValueType(1), b = 1.0.toDouble(), value = "v1", x = false) internal fun foo1(): kotlin.Unit
A(a = IntegerValueType(2), b = 2.0.toDouble(), value = "v2", x = true) internal fun foo2(): kotlin.Unit
A(a = IntegerValueType(4), b = 3.0.toDouble(), value = "v2", x = true) internal fun foo3(): kotlin.Unit
A(a = IntegerValueType(4), b = 3.0.toDouble(), value = "v2", x = true) internal fun foo4(): kotlin.Unit
A(a = 1, b = 1.0.toDouble(), value = "v1", x = false) internal fun foo1(): kotlin.Unit
A(a = 2, b = 2.0.toDouble(), value = "v2", x = true) internal fun foo2(): kotlin.Unit
A(a = 4, b = 3.0.toDouble(), value = "v2", x = true) internal fun foo3(): kotlin.Unit
A(a = 4, b = 3.0.toDouble(), value = "v2", x = true) internal fun foo4(): kotlin.Unit
public final class A : kotlin.Annotation {
public constructor A(/*0*/ value: kotlin.String, /*1*/ a: kotlin.Int, /*2*/ b: kotlin.Double, /*3*/ x: kotlin.Boolean)
@@ -1,8 +1,8 @@
package
A(a = IntegerValueType(1), b = 1.0.toDouble(), x = false) internal fun foo1(): kotlin.Unit
A(a = IntegerValueType(2), b = 2.0.toDouble(), x = true) internal fun foo2(): kotlin.Unit
A(a = IntegerValueType(4), b = 3.0.toDouble(), x = true) internal fun foo3(): kotlin.Unit
A(a = 1, b = 1.0.toDouble(), x = false) internal fun foo1(): kotlin.Unit
A(a = 2, b = 2.0.toDouble(), x = true) internal fun foo2(): kotlin.Unit
A(a = 4, b = 3.0.toDouble(), x = true) internal fun foo3(): kotlin.Unit
public final class A : kotlin.Annotation {
public constructor A(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Double, /*2*/ x: kotlin.Boolean)
@@ -6,11 +6,17 @@ fun foo(): Boolean = true
val x = 1
// val prop1: null
// val prop1: false
val prop1 = MyEnum.A
// val prop2: null
val prop2 = foo()
// val prop3: true
val prop3 = "$x"
val prop3 = "$x"
// val prop4: false
val prop4 = intArrayOf(1, 2, 3)
// val prop5: true
val prop5 = intArrayOf(1, 2, x, x)
+1 -1
View File
@@ -9,4 +9,4 @@ annotation class Ann(
Ann(1, 1.toByte(), 128.toByte(), 128) class MyClass
// EXPECTED: Ann(b1 = IntegerValueType(1), b2 = 1.toByte(), b3 = -128.toByte(), b4 = IntegerValueType(128))
// EXPECTED: Ann(b1 = 1.toByte(), b2 = 1.toByte(), b3 = -128.toByte(), b4 = 128)
@@ -4,4 +4,4 @@ annotation class Ann(val c1: Char)
Ann('a' - 'a') class MyClass
// EXPECTED: Ann(c1 = IntegerValueType(0))
// EXPECTED: Ann(c1 = 0)
@@ -9,4 +9,4 @@ annotation class Ann(
Ann(1 / 1, 1 / 1, 1 / 1, 1 / 1) class MyClass
// EXPECTED: Ann(b = IntegerValueType(1), i = IntegerValueType(1), l = IntegerValueType(1), s = IntegerValueType(1))
// EXPECTED: Ann(b = 1.toByte(), i = 1, l = 1.toLong(), s = 1.toShort())
@@ -10,4 +10,4 @@ annotation class Ann(
Ann(1 plus 1, 1 minus 1, 1 times 1, 1 div 1, 1 mod 1) class MyClass
// EXPECTED: Ann(p1 = IntegerValueType(2), p2 = IntegerValueType(0), p3 = IntegerValueType(1), p4 = IntegerValueType(1), p5 = IntegerValueType(0))
// EXPECTED: Ann(p1 = 2, p2 = 0, p3 = 1, p4 = 1, p5 = 0)
@@ -10,4 +10,4 @@ annotation class Ann(p1: Int,
Ann(1 or 1, 1 and 1, 1 xor 1, 1 shl 1, 1 shr 1, 1 ushr 1) class MyClass
// EXPECTED: Ann(p1 = IntegerValueType(1), p2 = IntegerValueType(1), p3 = IntegerValueType(0), p4 = IntegerValueType(2), p5 = IntegerValueType(0), p6 = IntegerValueType(0))
// EXPECTED: Ann(p1 = 1, p2 = 1.toShort(), p3 = 0.toByte(), p4 = 2, p5 = 0, p6 = 0)
@@ -8,4 +8,4 @@ annotation class Ann(
Ann(1 + 1, java.lang.Long.MAX_VALUE + 1 - 1, java.lang.Long.MAX_VALUE - 1) class MyClass
// EXPECTED: Ann(l1 = IntegerValueType(2), l2 = 9223372036854775807.toLong(), l3 = 9223372036854775806.toLong())
// EXPECTED: Ann(l1 = 2.toLong(), l2 = 9223372036854775807.toLong(), l3 = 9223372036854775806.toLong())
@@ -16,4 +16,4 @@ Ann(
p5 = 1.toByte() + 1.toByte()
) class MyClass
// EXPECTED: Ann(p1 = 128, p2 = IntegerValueType(2), p3 = 128, p4 = 2, p5 = 2)
// EXPECTED: Ann(p1 = 128, p2 = 2.toByte(), p3 = 128, p4 = 2, p5 = 2)
@@ -16,4 +16,4 @@ Ann(
p5 = 1.toInt() + 1.toInt()
) class MyClass
// EXPECTED: Ann(p1 = -2147483648, p2 = IntegerValueType(2), p3 = -2147483648, p4 = 2, p5 = 2)
// EXPECTED: Ann(p1 = -2147483648, p2 = 2, p3 = -2147483648, p4 = 2, p5 = 2)
@@ -9,4 +9,4 @@ annotation class Ann(
Ann(1 * 1, 1 * 1, 1 * 1, 1 * 1) class MyClass
// EXPECTED: Ann(b = IntegerValueType(1), i = IntegerValueType(1), l = IntegerValueType(1), s = IntegerValueType(1))
// EXPECTED: Ann(b = 1.toByte(), i = 1, l = 1.toLong(), s = 1.toShort())
@@ -9,4 +9,4 @@ annotation class Ann(
Ann(1 - 1, 1 - 1, 1 - 1, 1 - 1) class MyClass
// EXPECTED: Ann(b = IntegerValueType(0), i = IntegerValueType(0), l = IntegerValueType(0), s = IntegerValueType(0))
// EXPECTED: Ann(b = 0.toByte(), i = 0, l = 0.toLong(), s = 0.toShort())
@@ -9,4 +9,4 @@ annotation class Ann(
Ann(1 % 1, 1 % 1, 1 % 1, 1 % 1) class MyClass
// EXPECTED: Ann(b = IntegerValueType(0), i = IntegerValueType(0), l = IntegerValueType(0), s = IntegerValueType(0))
// EXPECTED: Ann(b = 0.toByte(), i = 0, l = 0.toLong(), s = 0.toShort())
@@ -4,4 +4,4 @@ annotation class Ann(i: Int)
Ann((1 + 2) * 2) class MyClass
// EXPECTED: Ann(i = IntegerValueType(6))
// EXPECTED: Ann(i = 6)
@@ -9,4 +9,4 @@ annotation class Ann(
Ann(1 + 1, 1 + 1, 1 + 1, 1 + 1) class MyClass
// EXPECTED: Ann(b = IntegerValueType(2), i = IntegerValueType(2), l = IntegerValueType(2), s = IntegerValueType(2))
// EXPECTED: Ann(b = 2.toByte(), i = 2, l = 2.toLong(), s = 2.toShort())
@@ -10,4 +10,4 @@ annotation class Ann(
Ann(1.plus(1), 1.minus(1), 1.times(1), 1.div(1), 1.mod(1)) class MyClass
// EXPECTED: Ann(p1 = IntegerValueType(2), p2 = IntegerValueType(0), p3 = IntegerValueType(1), p4 = IntegerValueType(1), p5 = IntegerValueType(0))
// EXPECTED: Ann(p1 = 2, p2 = 0, p3 = 1, p4 = 1, p5 = 0)
@@ -11,4 +11,4 @@ annotation class Ann(
Ann(-1, -1, -1, -1, -1.0, -1.0.toFloat()) class MyClass
// EXPECTED: Ann(b1 = IntegerValueType(-1), b2 = IntegerValueType(-1), b3 = IntegerValueType(-1), b4 = IntegerValueType(-1), b5 = -1.0.toDouble(), b6 = -1.0.toFloat())
// EXPECTED: Ann(b1 = -1.toByte(), b2 = -1.toShort(), b3 = -1, b4 = -1.toLong(), b5 = -1.0.toDouble(), b6 = -1.0.toFloat())
@@ -11,4 +11,4 @@ annotation class Ann(
Ann(+1, +1, +1, +1, +1.0, +1.0.toFloat()) class MyClass
// EXPECTED: Ann(b1 = IntegerValueType(1), b2 = IntegerValueType(1), b3 = IntegerValueType(1), b4 = IntegerValueType(1), b5 = 1.0.toDouble(), b6 = 1.0.toFloat())
// EXPECTED: Ann(b1 = 1.toByte(), b2 = 1.toShort(), b3 = 1, b4 = 1.toLong(), b5 = 1.0.toDouble(), b6 = 1.0.toFloat())
+1 -1
View File
@@ -9,4 +9,4 @@ annotation class Ann(
Ann(1, 1.toInt(), 2147483648.toInt(), 2147483648) class MyClass
// EXPECTED: Ann(b1 = IntegerValueType(1), b2 = 1, b3 = -2147483648, b4 = IntegerValueType(2147483648))
// EXPECTED: Ann(b1 = 1, b2 = 1, b3 = -2147483648, b4 = 2147483648.toLong())
+1 -1
View File
@@ -7,4 +7,4 @@ annotation class Ann(
Ann(1, 1.toLong()) class MyClass
// EXPECTED: Ann(b1 = IntegerValueType(1), b2 = 1.toLong())
// EXPECTED: Ann(b1 = 1.toLong(), b2 = 1.toLong())
+1 -1
View File
@@ -9,4 +9,4 @@ annotation class Ann(
Ann(1, 1.toShort(), 32768.toShort(), 32768) class MyClass
// EXPECTED: Ann(b1 = IntegerValueType(1), b2 = 1.toShort(), b3 = -32768.toShort(), b4 = IntegerValueType(32768))
// EXPECTED: Ann(b1 = 1.toShort(), b2 = 1.toShort(), b3 = -32768.toShort(), b4 = 32768)