[FIR] Allow annotation instantiation.

This commit disables the frontend error reporting for supported cases.
This commit is contained in:
Mads Ager
2021-11-02 17:17:34 +01:00
committed by TeamCityServer
parent 56d472451c
commit b79ca7d7df
24 changed files with 32 additions and 78 deletions
@@ -1,18 +0,0 @@
// WITH_RUNTIME
// SKIP_TXT
// !LANGUAGE: +InstantiationOfAnnotationClasses
import kotlin.reflect.KClass
annotation class A
annotation class B(val int: Int)
annotation class C(val int: Int = 42)
annotation class G<T: Any>(val int: KClass<T>)
fun box() {
val a = <!ANNOTATION_CLASS_CONSTRUCTOR_CALL!>A()<!>
val b = <!ANNOTATION_CLASS_CONSTRUCTOR_CALL!>B(4)<!>
val c = <!ANNOTATION_CLASS_CONSTRUCTOR_CALL!>C()<!>
val foo = <!ANNOTATION_CLASS_CONSTRUCTOR_CALL!>G(Int::class)<!>
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// WITH_RUNTIME
// SKIP_TXT
// !LANGUAGE: +InstantiationOfAnnotationClasses
@@ -7,8 +7,8 @@ val test1a = <!CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS!>AbstractClass()<!>
annotation class AnnotationClass
typealias Test2 = AnnotationClass
val test2 = <!ANNOTATION_CLASS_CONSTRUCTOR_CALL!>Test2()<!>
val test2a = <!ANNOTATION_CLASS_CONSTRUCTOR_CALL!>AnnotationClass()<!>
val test2 = Test2()
val test2a = AnnotationClass()
enum class EnumClass { VALUE1, VALUE2 }
typealias Test3 = EnumClass