[K2/N] KT-55464, KT-56091 Fix various klib annotations, including critical ones
Merge-request: KT-MR-8457 Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
53967a1822
commit
1990883bdc
@@ -0,0 +1,38 @@
|
||||
package test
|
||||
annotation class AnnoClass
|
||||
annotation class AnnoConstructor
|
||||
annotation class AnnoConstructorParameter
|
||||
annotation class AnnoProperty
|
||||
annotation class AnnoSetParam
|
||||
annotation class AnnoSetParam2
|
||||
annotation class AnnoBackingField
|
||||
annotation class AnnoGetter
|
||||
annotation class AnnoSetter
|
||||
annotation class AnnoSetter2
|
||||
annotation class AnnoDelegatedField
|
||||
annotation class AnnoFunction
|
||||
annotation class AnnoFunctionParam
|
||||
annotation class AnnoFunctionExtensionReceiver
|
||||
annotation class AnnoPropertyExtensionReceiver
|
||||
@AnnoClass
|
||||
class Foo @AnnoConstructor constructor(@AnnoConstructorParameter i: Int) {
|
||||
@AnnoProperty
|
||||
@setparam:AnnoSetParam
|
||||
@field:AnnoBackingField
|
||||
var prop: Int = i
|
||||
@AnnoGetter
|
||||
get() = field + 1
|
||||
@AnnoSetter
|
||||
set(x: Int) { field = x*2 }
|
||||
|
||||
@set:AnnoSetter2
|
||||
var mutableProp = 0
|
||||
set(@AnnoSetParam2 x: Int) { field = x*2 }
|
||||
|
||||
@delegate:AnnoDelegatedField
|
||||
val immutableProp by lazy { prop }
|
||||
}
|
||||
@AnnoFunction
|
||||
fun @receiver:AnnoFunctionExtensionReceiver Foo.extfun(@AnnoFunctionParam x: Int) {}
|
||||
@AnnoPropertyExtensionReceiver
|
||||
val Foo.extProp get() = this.prop
|
||||
@@ -0,0 +1,25 @@
|
||||
annotation class AnnoBackingField constructor() : Annotation
|
||||
annotation class AnnoClass constructor() : Annotation
|
||||
annotation class AnnoConstructor constructor() : Annotation
|
||||
annotation class AnnoConstructorParameter constructor() : Annotation
|
||||
annotation class AnnoDelegatedField constructor() : Annotation
|
||||
annotation class AnnoFunction constructor() : Annotation
|
||||
annotation class AnnoFunctionExtensionReceiver constructor() : Annotation
|
||||
annotation class AnnoFunctionParam constructor() : Annotation
|
||||
annotation class AnnoGetter constructor() : Annotation
|
||||
annotation class AnnoProperty constructor() : Annotation
|
||||
annotation class AnnoPropertyExtensionReceiver constructor() : Annotation
|
||||
annotation class AnnoSetParam constructor() : Annotation
|
||||
annotation class AnnoSetParam2 constructor() : Annotation
|
||||
annotation class AnnoSetter constructor() : Annotation
|
||||
annotation class AnnoSetter2 constructor() : Annotation
|
||||
@AnnoClass class Foo @AnnoConstructor constructor(@AnnoConstructorParameter i: Int) {
|
||||
@delegate:AnnoDelegatedField val immutableProp: Int
|
||||
var mutableProp: Int
|
||||
@AnnoSetter2 set
|
||||
@AnnoProperty @field:AnnoBackingField var prop: Int
|
||||
@AnnoGetter get
|
||||
@AnnoSetter set
|
||||
}
|
||||
@AnnoPropertyExtensionReceiver val Foo.extProp: Int
|
||||
@AnnoFunction fun @receiver:AnnoFunctionExtensionReceiver Foo.extfun(@AnnoFunctionParam x: Int)
|
||||
@@ -0,0 +1,53 @@
|
||||
package test
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class AnnoClass
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class AnnoConstructor
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class AnnoConstructorParameter
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class AnnoProperty
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class AnnoSetParam
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class AnnoSetParam2
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class AnnoBackingField
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class AnnoGetter
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class AnnoSetter
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class AnnoSetter2
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class AnnoDelegatedField
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class AnnoFunction
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class AnnoFunctionParam
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class AnnoFunctionExtensionReceiver
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class AnnoPropertyExtensionReceiver
|
||||
@AnnoClass
|
||||
class Foo @AnnoConstructor constructor(@AnnoConstructorParameter i: Int) {
|
||||
@AnnoProperty
|
||||
@setparam:AnnoSetParam
|
||||
@field:AnnoBackingField
|
||||
var prop: Int = i
|
||||
@AnnoGetter
|
||||
get() = field + 1
|
||||
@AnnoSetter
|
||||
set(x: Int) { field = x*2 }
|
||||
|
||||
@set:AnnoSetter2
|
||||
var mutableProp = 0
|
||||
set(@AnnoSetParam2 x: Int) { field = x*2 }
|
||||
|
||||
@delegate:AnnoDelegatedField
|
||||
val immutableProp by lazy { prop }
|
||||
}
|
||||
@AnnoFunction
|
||||
fun @receiver:AnnoFunctionExtensionReceiver Foo.extfun(@AnnoFunctionParam x: Int) {}
|
||||
@AnnoPropertyExtensionReceiver
|
||||
val Foo.extProp get() = this.prop
|
||||
@@ -0,0 +1,22 @@
|
||||
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoBackingField constructor() : Annotation
|
||||
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoClass constructor() : Annotation
|
||||
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoConstructor constructor() : Annotation
|
||||
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoConstructorParameter constructor() : Annotation
|
||||
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoDelegatedField constructor() : Annotation
|
||||
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoFunction constructor() : Annotation
|
||||
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoFunctionExtensionReceiver constructor() : Annotation
|
||||
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoFunctionParam constructor() : Annotation
|
||||
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoGetter constructor() : Annotation
|
||||
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoProperty constructor() : Annotation
|
||||
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoPropertyExtensionReceiver constructor() : Annotation
|
||||
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoSetParam constructor() : Annotation
|
||||
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoSetParam2 constructor() : Annotation
|
||||
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoSetter constructor() : Annotation
|
||||
@Retention(value = AnnotationRetention.SOURCE) annotation class AnnoSetter2 constructor() : Annotation
|
||||
class Foo constructor(i: Int) {
|
||||
val immutableProp: Int
|
||||
var mutableProp: Int
|
||||
var prop: Int
|
||||
}
|
||||
val Foo.extProp: Int
|
||||
fun Foo.extfun(x: Int)
|
||||
@@ -0,0 +1,5 @@
|
||||
package test
|
||||
class C
|
||||
|
||||
// If serializeTypeAnnotation() is wrong, the following callback would have wrong type: (C) -> Unit
|
||||
fun C.builder(c: C.() -> Unit) {}
|
||||
@@ -0,0 +1,2 @@
|
||||
class C constructor()
|
||||
fun C.builder(c: C.() -> Unit)
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package test
|
||||
annotation class Annotation
|
||||
|
||||
fun foo(@Annotation arg: Int) {}
|
||||
|
||||
// KT-56177 TODO uncomment the line after KT-56177 is fixed
|
||||
//data class Clazz(@Annotation val param: Int)
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
annotation class Annotation constructor() : Annotation
|
||||
fun foo(@Annotation arg: Int)
|
||||
@@ -0,0 +1,14 @@
|
||||
package test
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class AnnoRuntime
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class AnnoBinary
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class AnnoSource
|
||||
|
||||
fun withRuntimeAnnotation(id: @AnnoRuntime Int) {}
|
||||
fun withBinaryAnnotation(id: @AnnoBinary Int) {}
|
||||
fun withSourceAnnotation(id: @AnnoSource Int) {}
|
||||
@@ -0,0 +1,6 @@
|
||||
@Retention(value = AnnotationRetention.BINARY) @Target(allowedTargets = {AnnotationTarget.TYPE}) annotation class AnnoBinary constructor() : Annotation
|
||||
@Retention(value = AnnotationRetention.RUNTIME) @Target(allowedTargets = {AnnotationTarget.TYPE}) annotation class AnnoRuntime constructor() : Annotation
|
||||
@Retention(value = AnnotationRetention.SOURCE) @Target(allowedTargets = {AnnotationTarget.TYPE}) annotation class AnnoSource constructor() : Annotation
|
||||
fun withBinaryAnnotation(id: @AnnoBinary Int)
|
||||
fun withRuntimeAnnotation(id: @AnnoRuntime Int)
|
||||
fun withSourceAnnotation(id: Int)
|
||||
Reference in New Issue
Block a user