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
@@ -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)