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