[KLIB][tests] Reorganize "klib dump-metadata" tests
- Keep the test data under "native/native.tests/testData/klib/" dir - Rename tests from "klib contents" to "klib dump-metadata"
This commit is contained in:
committed by
Space Team
parent
ec9370c30b
commit
cb92990ed6
@@ -0,0 +1,52 @@
|
||||
// KT-57135 K2 dosen't take into account `field` target on annotation for property
|
||||
// MUTED_WHEN: K2
|
||||
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
|
||||
|
||||
@Target(AnnotationTarget.TYPE_PARAMETER)
|
||||
annotation class AnnoFunctionTypeParameter
|
||||
@Target(AnnotationTarget.TYPE_PARAMETER)
|
||||
annotation class AnnoClassTypeParameter
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class AnnoClassUsageTypeParameter
|
||||
|
||||
@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
|
||||
|
||||
fun <@AnnoFunctionTypeParameter T> f(x : B<@AnnoClassUsageTypeParameter Int>) {}
|
||||
class B<@AnnoClassTypeParameter T>
|
||||
@@ -0,0 +1,30 @@
|
||||
annotation class AnnoBackingField constructor() : Annotation
|
||||
annotation class AnnoClass constructor() : Annotation
|
||||
@Target(allowedTargets = {AnnotationTarget.TYPE_PARAMETER}) annotation class AnnoClassTypeParameter constructor() : Annotation
|
||||
@Target(allowedTargets = {AnnotationTarget.TYPE}) annotation class AnnoClassUsageTypeParameter 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
|
||||
@Target(allowedTargets = {AnnotationTarget.TYPE_PARAMETER}) annotation class AnnoFunctionTypeParameter 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
|
||||
class B<@AnnoClassTypeParameter T> constructor()
|
||||
@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)
|
||||
fun <@AnnoFunctionTypeParameter T> f(x: B<@AnnoClassUsageTypeParameter Int>)
|
||||
+53
@@ -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
|
||||
+22
@@ -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)
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package test
|
||||
|
||||
annotation class Anno(val value: String = "0", val x: Int = 0)
|
||||
annotation class Bnno
|
||||
|
||||
enum class Eee {
|
||||
@Anno()
|
||||
Entry1,
|
||||
Entry2,
|
||||
@Anno("3") @Bnno
|
||||
Entry3,
|
||||
@Anno("4", 4)
|
||||
Entry4,
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
annotation class Anno constructor(value: String = ..., x: Int = ...) : Annotation {
|
||||
val value: String
|
||||
val x: Int
|
||||
}
|
||||
annotation class Bnno constructor() : Annotation
|
||||
enum class Eee private constructor() : Enum<Eee> {
|
||||
@Anno enum entry Entry1
|
||||
enum entry Entry2
|
||||
@Anno(value = "3") @Bnno enum entry Entry3
|
||||
@Anno(value = "4", x = 4) enum entry Entry4
|
||||
}
|
||||
native/native.tests/testData/klib/dump-metadata/builtinsSerializer/annotationArguments/annotation.kt
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
package test
|
||||
|
||||
annotation class Empty
|
||||
|
||||
annotation class JustAnnotation(val annotation: Empty)
|
||||
|
||||
annotation class AnnotationArray(val annotationArray: Array<JustAnnotation>)
|
||||
|
||||
@JustAnnotation(Empty())
|
||||
@AnnotationArray(arrayOf())
|
||||
class C1
|
||||
|
||||
@AnnotationArray(arrayOf(JustAnnotation(Empty()), JustAnnotation(Empty())))
|
||||
class C2
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
annotation class AnnotationArray constructor(annotationArray: Array<JustAnnotation>) : Annotation {
|
||||
val annotationArray: Array<JustAnnotation>
|
||||
}
|
||||
@JustAnnotation(annotation = Empty) @AnnotationArray(annotationArray = {}) class C1 constructor()
|
||||
@AnnotationArray(annotationArray = {JustAnnotation(annotation = Empty), JustAnnotation(annotation = Empty)}) class C2 constructor()
|
||||
annotation class Empty constructor() : Annotation
|
||||
annotation class JustAnnotation constructor(annotation: Empty) : Annotation {
|
||||
val annotation: Empty
|
||||
}
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
package test
|
||||
|
||||
enum class Weapon {
|
||||
ROCK,
|
||||
PAPER,
|
||||
SCISSORS
|
||||
}
|
||||
|
||||
annotation class JustEnum(val weapon: Weapon)
|
||||
|
||||
annotation class EnumArray(val enumArray: Array<Weapon>)
|
||||
|
||||
@JustEnum(Weapon.SCISSORS)
|
||||
@EnumArray(arrayOf())
|
||||
class C1
|
||||
|
||||
@EnumArray(arrayOf(Weapon.PAPER, Weapon.ROCK))
|
||||
class C2
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
@JustEnum(weapon = Weapon.SCISSORS) @EnumArray(enumArray = {}) class C1 constructor()
|
||||
@EnumArray(enumArray = {Weapon.PAPER, Weapon.ROCK}) class C2 constructor()
|
||||
annotation class EnumArray constructor(enumArray: Array<Weapon>) : Annotation {
|
||||
val enumArray: Array<Weapon>
|
||||
}
|
||||
annotation class JustEnum constructor(weapon: Weapon) : Annotation {
|
||||
val weapon: Weapon
|
||||
}
|
||||
enum class Weapon private constructor() : Enum<Weapon> {
|
||||
enum entry ROCK
|
||||
enum entry PAPER
|
||||
enum entry SCISSORS
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package test
|
||||
|
||||
annotation class PrimitiveArrays(
|
||||
val byteArray: ByteArray,
|
||||
val charArray: CharArray,
|
||||
val shortArray: ShortArray,
|
||||
val intArray: IntArray,
|
||||
val longArray: LongArray,
|
||||
val floatArray: FloatArray,
|
||||
val doubleArray: DoubleArray,
|
||||
val booleanArray: BooleanArray
|
||||
)
|
||||
|
||||
@PrimitiveArrays(
|
||||
byteArray = byteArrayOf(-7, 7),
|
||||
charArray = charArrayOf('%', 'z'),
|
||||
shortArray = shortArrayOf(239),
|
||||
intArray = intArrayOf(239017, -1),
|
||||
longArray = longArrayOf(123456789123456789L),
|
||||
floatArray = floatArrayOf(2.72f, 0f),
|
||||
doubleArray = doubleArrayOf(-3.14),
|
||||
booleanArray = booleanArrayOf(true, false, true)
|
||||
)
|
||||
class C1
|
||||
|
||||
@PrimitiveArrays(
|
||||
byteArray = byteArrayOf(),
|
||||
charArray = charArrayOf(),
|
||||
shortArray = shortArrayOf(),
|
||||
intArray = intArrayOf(),
|
||||
longArray = longArrayOf(),
|
||||
floatArray = floatArrayOf(),
|
||||
doubleArray = doubleArrayOf(),
|
||||
booleanArray = booleanArrayOf()
|
||||
)
|
||||
class C2
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
@PrimitiveArrays(booleanArray = {true, false, true}, byteArray = {-7.toByte(), 7.toByte()}, charArray = {\u0025 ('%'), \u007A ('z')}, doubleArray = {-3.14.toDouble()}, floatArray = {2.72.toFloat(), 0.0.toFloat()}, intArray = {239017, -1}, longArray = {123456789123456789.toLong()}, shortArray = {239.toShort()}) class C1 constructor()
|
||||
@PrimitiveArrays(booleanArray = {}, byteArray = {}, charArray = {}, doubleArray = {}, floatArray = {}, intArray = {}, longArray = {}, shortArray = {}) class C2 constructor()
|
||||
annotation class PrimitiveArrays constructor(byteArray: ByteArray, charArray: CharArray, shortArray: ShortArray, intArray: IntArray, longArray: LongArray, floatArray: FloatArray, doubleArray: DoubleArray, booleanArray: BooleanArray) : Annotation {
|
||||
val booleanArray: BooleanArray
|
||||
val byteArray: ByteArray
|
||||
val charArray: CharArray
|
||||
val doubleArray: DoubleArray
|
||||
val floatArray: FloatArray
|
||||
val intArray: IntArray
|
||||
val longArray: LongArray
|
||||
val shortArray: ShortArray
|
||||
}
|
||||
native/native.tests/testData/klib/dump-metadata/builtinsSerializer/annotationArguments/primitives.kt
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
package test
|
||||
|
||||
annotation class Primitives(
|
||||
val byte: Byte,
|
||||
val char: Char,
|
||||
val short: Short,
|
||||
val int: Int,
|
||||
val long: Long,
|
||||
val float: Float,
|
||||
val double: Double,
|
||||
val boolean: Boolean
|
||||
)
|
||||
|
||||
@Primitives(
|
||||
byte = 7,
|
||||
char = '%',
|
||||
short = 239,
|
||||
int = 239017,
|
||||
long = 123456789123456789L,
|
||||
float = 2.72f,
|
||||
double = -3.14,
|
||||
boolean = true
|
||||
)
|
||||
class C
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
@Primitives(boolean = true, byte = 7.toByte(), char = \u0025 ('%'), double = -3.14.toDouble(), float = 2.72.toFloat(), int = 239017, long = 123456789123456789.toLong(), short = 239.toShort()) class C constructor()
|
||||
annotation class Primitives constructor(byte: Byte, char: Char, short: Short, int: Int, long: Long, float: Float, double: Double, boolean: Boolean) : Annotation {
|
||||
val boolean: Boolean
|
||||
val byte: Byte
|
||||
val char: Char
|
||||
val double: Double
|
||||
val float: Float
|
||||
val int: Int
|
||||
val long: Long
|
||||
val short: Short
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
package test
|
||||
|
||||
annotation class JustString(val string: String)
|
||||
|
||||
annotation class StringArray(val stringArray: Array<String>)
|
||||
|
||||
@JustString("kotlin")
|
||||
@StringArray(arrayOf())
|
||||
class C1
|
||||
|
||||
@StringArray(arrayOf("java", ""))
|
||||
class C2
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
@JustString(string = "kotlin") @StringArray(stringArray = {}) class C1 constructor()
|
||||
@StringArray(stringArray = {"java", ""}) class C2 constructor()
|
||||
annotation class JustString constructor(string: String) : Annotation {
|
||||
val string: String
|
||||
}
|
||||
annotation class StringArray constructor(stringArray: Array<String>) : Annotation {
|
||||
val stringArray: Array<String>
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
package test
|
||||
|
||||
enum class My { ALPHA, BETA, OMEGA }
|
||||
|
||||
annotation class ann(vararg val m: My)
|
||||
|
||||
@ann(My.ALPHA, My.BETA) annotation class annotated
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
enum class My private constructor() : Enum<My> {
|
||||
enum entry ALPHA
|
||||
enum entry BETA
|
||||
enum entry OMEGA
|
||||
}
|
||||
annotation class ann constructor(vararg m: My) : Annotation {
|
||||
val m: Array<out My>
|
||||
}
|
||||
@ann(m = {My.ALPHA, My.BETA}) annotation class annotated constructor() : Annotation
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package test
|
||||
|
||||
annotation class anno(val x: String)
|
||||
|
||||
|
||||
@anno("top level function")
|
||||
fun f1(@anno("top level function parameter") p: Int) {}
|
||||
|
||||
@anno("top level property")
|
||||
val p1 = null
|
||||
|
||||
@anno("extension function")
|
||||
fun Long.f2(@anno("extension function parameter") p: Int) {}
|
||||
|
||||
@anno("extension property")
|
||||
val Double.p2: Double get() = 0.0
|
||||
|
||||
@anno("top level class")
|
||||
class C1 @anno("constructor") constructor() {
|
||||
@anno("member function")
|
||||
fun f3(@anno("member function parameter") p: Int) {}
|
||||
|
||||
@anno("member property")
|
||||
val p3 = null
|
||||
|
||||
@anno("member extension function")
|
||||
fun String.f4() {}
|
||||
|
||||
@anno("member extension property")
|
||||
val Int.v4: Int get() = this
|
||||
|
||||
@anno("nested class")
|
||||
class C2
|
||||
|
||||
@anno("companion object")
|
||||
companion object {}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
@anno(x = "top level class") class C1 @anno(x = "constructor") constructor() {
|
||||
@anno(x = "member property") val p3: Nothing?
|
||||
@anno(x = "member extension property") val Int.v4: Int
|
||||
@anno(x = "member function") fun f3(@anno(x = "member function parameter") p: Int)
|
||||
@anno(x = "member extension function") fun String.f4()
|
||||
@anno(x = "nested class") class C2 constructor()
|
||||
@anno(x = "companion object") companion object
|
||||
}
|
||||
annotation class anno constructor(x: String) : Annotation {
|
||||
val x: String
|
||||
}
|
||||
@anno(x = "top level function") fun f1(@anno(x = "top level function parameter") p: Int)
|
||||
@anno(x = "extension function") fun Long.f2(@anno(x = "extension function parameter") p: Int)
|
||||
@anno(x = "top level property") val p1: Nothing?
|
||||
@anno(x = "extension property") val Double.p2: Double
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
package test
|
||||
|
||||
import kotlin.annotation.AnnotationTarget.*
|
||||
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@Target(CLASS, CONSTRUCTOR, FUNCTION, PROPERTY, VALUE_PARAMETER, TYPE, TYPE_PARAMETER)
|
||||
annotation class A
|
||||
|
||||
@A
|
||||
class Klass @A constructor()
|
||||
|
||||
@A
|
||||
fun <@A T> function(@A param: Unit): @A Unit {}
|
||||
|
||||
@A
|
||||
val property = Unit
|
||||
|
||||
enum class Enum {
|
||||
@A
|
||||
ENTRY
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
@Retention(value = AnnotationRetention.BINARY) @Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER}) annotation class A constructor() : Annotation
|
||||
enum class Enum private constructor() : Enum<Enum> {
|
||||
@A enum entry ENTRY
|
||||
}
|
||||
@A class Klass @A constructor()
|
||||
@A fun <@A T> function(@A param: Unit)
|
||||
@A val property: Unit
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package test
|
||||
|
||||
enum class Weapon {
|
||||
ROCK,
|
||||
PAPER,
|
||||
SCISSORS
|
||||
}
|
||||
|
||||
val byteConst: Byte = 10
|
||||
val shortConst: Short = 20
|
||||
val intConst: Int = 30
|
||||
val longConst: Long = 40
|
||||
val charConst: Char = 'A'
|
||||
val stringConst: String = "abcd"
|
||||
val booleanConst: Boolean = true
|
||||
val floatConst: Float = 2.0f
|
||||
val doubleConst: Double = 3.0
|
||||
val enumConst: Weapon? = Weapon.ROCK
|
||||
val arrayConst: Any = byteArrayOf(1,2)
|
||||
|
||||
class Class {
|
||||
val byteConst: Byte = 10
|
||||
val shortConst: Short = 20
|
||||
val intConst: Int = 30
|
||||
val longConst: Long = 40
|
||||
val charConst: Char = 'A'
|
||||
val stringConst: String = "abcd"
|
||||
val booleanConst: Boolean = true
|
||||
val floatConst: Float = 2.0f
|
||||
val doubleConst: Double = 3.0
|
||||
val enumConst: Weapon? = Weapon.ROCK
|
||||
val arrayConst: Any = byteArrayOf(1,2)
|
||||
}
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
class Class constructor() {
|
||||
val arrayConst: Any = {1.toByte(), 2.toByte()}
|
||||
val booleanConst: Boolean = true
|
||||
val byteConst: Byte = 10.toByte()
|
||||
val charConst: Char = \u0041 ('A')
|
||||
val doubleConst: Double = 3.0.toDouble()
|
||||
val enumConst: Weapon? = Weapon.ROCK
|
||||
val floatConst: Float = 2.0.toFloat()
|
||||
val intConst: Int = 30
|
||||
val longConst: Long = 40.toLong()
|
||||
val shortConst: Short = 20.toShort()
|
||||
val stringConst: String = "abcd"
|
||||
}
|
||||
enum class Weapon private constructor() : Enum<Weapon> {
|
||||
enum entry ROCK
|
||||
enum entry PAPER
|
||||
enum entry SCISSORS
|
||||
}
|
||||
val arrayConst: Any = {1.toByte(), 2.toByte()}
|
||||
val booleanConst: Boolean = true
|
||||
val byteConst: Byte = 10.toByte()
|
||||
val charConst: Char = \u0041 ('A')
|
||||
val doubleConst: Double = 3.0.toDouble()
|
||||
val enumConst: Weapon? = Weapon.ROCK
|
||||
val floatConst: Float = 2.0.toFloat()
|
||||
val intConst: Int = 30
|
||||
val longConst: Long = 40.toLong()
|
||||
val shortConst: Short = 20.toShort()
|
||||
val stringConst: String = "abcd"
|
||||
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
package test
|
||||
|
||||
class ClassA {
|
||||
class classB {
|
||||
fun memberFromB(): Int = 100
|
||||
|
||||
class BC {
|
||||
val memberFromBB: Int = 150
|
||||
}
|
||||
|
||||
object BO {
|
||||
val memberFromBO: Int = 175
|
||||
}
|
||||
}
|
||||
|
||||
inner class classC {
|
||||
val memberFromC: Int = 200
|
||||
}
|
||||
}
|
||||
|
||||
class E {
|
||||
companion object {
|
||||
val stat: Int = 250
|
||||
|
||||
class D {
|
||||
val memberFromD: Int = 275
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class F {
|
||||
object ObjA {
|
||||
val memberFromObjA: Int = 300
|
||||
}
|
||||
}
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
class ClassA constructor() {
|
||||
class classB constructor() {
|
||||
fun memberFromB(): Int
|
||||
class BC constructor() {
|
||||
val memberFromBB: Int = 150
|
||||
}
|
||||
object BO {
|
||||
val memberFromBO: Int = 175
|
||||
}
|
||||
}
|
||||
inner class classC constructor() {
|
||||
val memberFromC: Int = 200
|
||||
}
|
||||
}
|
||||
class E constructor() {
|
||||
companion object {
|
||||
val stat: Int = 250
|
||||
class D constructor() {
|
||||
val memberFromD: Int = 275
|
||||
}
|
||||
}
|
||||
}
|
||||
class F constructor() {
|
||||
object ObjA {
|
||||
val memberFromObjA: Int = 300
|
||||
}
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
package test
|
||||
|
||||
annotation class Anno(val value: String)
|
||||
|
||||
@Anno("property") val v1 = ""
|
||||
|
||||
var v2: String
|
||||
@Anno("getter") get() = ""
|
||||
@Anno("setter") set(@Anno("setparam") value) {
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
annotation class Anno constructor(value: String) : Annotation {
|
||||
val value: String
|
||||
}
|
||||
@Anno(value = "property") val v1: String = ""
|
||||
var v2: String
|
||||
@Anno(value = "getter") get
|
||||
@Anno(value = "setter") set
|
||||
@@ -0,0 +1,11 @@
|
||||
package test
|
||||
|
||||
class Class {
|
||||
fun member() = null
|
||||
}
|
||||
|
||||
fun function(int: Int, string: String = "default"): Class = Class()
|
||||
|
||||
fun <T> T.extension(): T? = null
|
||||
|
||||
val property: Unit = Unit
|
||||
@@ -0,0 +1,6 @@
|
||||
class Class constructor() {
|
||||
fun member(): Nothing?
|
||||
}
|
||||
fun <T> T.extension(): T?
|
||||
fun function(int: Int, string: String = ...): Class
|
||||
val property: Unit
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
package test
|
||||
|
||||
import kotlin.annotation.AnnotationTarget.*
|
||||
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
@Target(CLASS, CONSTRUCTOR, FUNCTION, PROPERTY, VALUE_PARAMETER, TYPE, TYPE_PARAMETER)
|
||||
annotation class A
|
||||
|
||||
@A
|
||||
class Klass @A constructor()
|
||||
|
||||
@A
|
||||
fun <@A T> function(@A param: Unit): @A Unit {}
|
||||
|
||||
@A
|
||||
val property = Unit
|
||||
|
||||
enum class Enum {
|
||||
@A
|
||||
ENTRY
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
@Retention(value = AnnotationRetention.SOURCE) @Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER}) annotation class A constructor() : Annotation
|
||||
enum class Enum private constructor() : Enum<Enum> {
|
||||
enum entry ENTRY
|
||||
}
|
||||
class Klass constructor()
|
||||
fun <T> function(param: Unit)
|
||||
val property: Unit
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
object Obj {
|
||||
const val O = "O"
|
||||
val concat = "${O}K"
|
||||
}
|
||||
|
||||
@Deprecated("${Obj.O}/{id}")
|
||||
class Foo
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package <root> {
|
||||
@Deprecated(message = "O/{id}") class Foo constructor()
|
||||
object Obj {
|
||||
const val O: String = "O"
|
||||
val concat: String = "OK"
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
package test
|
||||
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@Target(AnnotationTarget.TYPE_PARAMETER)
|
||||
annotation class Ann(val value: String)
|
||||
inline fun <reified @Ann("abc") T> foo() {}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
@Retention(value = AnnotationRetention.BINARY) @Target(allowedTargets = {AnnotationTarget.TYPE_PARAMETER}) annotation class Ann constructor(value: String) : Annotation {
|
||||
val value: String
|
||||
}
|
||||
inline fun <reified @Ann(value = "abc") T> foo()
|
||||
@@ -0,0 +1,11 @@
|
||||
// MUTED_WHEN: K1
|
||||
package test
|
||||
|
||||
data class DataClass(
|
||||
val intProp: Int,
|
||||
val stringProp: String
|
||||
) {
|
||||
val nonConstructorProp: Int = 0
|
||||
}
|
||||
|
||||
data object DataObject
|
||||
@@ -0,0 +1,16 @@
|
||||
data class DataClass constructor(intProp: Int, stringProp: String) {
|
||||
val intProp: Int
|
||||
val nonConstructorProp: Int = 0
|
||||
val stringProp: String
|
||||
operator fun component1(): Int
|
||||
operator fun component2(): String
|
||||
fun copy(intProp: Int = ..., stringProp: String = ...): DataClass
|
||||
override fun equals(other: Any?): Boolean
|
||||
override fun hashCode(): Int
|
||||
override fun toString(): String
|
||||
}
|
||||
data object DataObject {
|
||||
override fun equals(other: Any?): Boolean
|
||||
override fun hashCode(): Int
|
||||
override fun toString(): String
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// KT-57135 K2 dosen't take into account `field` target on annotation for property
|
||||
// MUTED_WHEN: K2
|
||||
package test
|
||||
|
||||
annotation class Ann
|
||||
|
||||
@field:Ann
|
||||
var x: Int = 5
|
||||
@delegate:Ann
|
||||
var y: Int by ::x
|
||||
|
||||
class A {
|
||||
@field:Ann
|
||||
var x: Int = 5
|
||||
@delegate:Ann
|
||||
var y: Int by ::x
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class A constructor() {
|
||||
@field:Ann var x: Int
|
||||
@delegate:Ann var y: Int
|
||||
}
|
||||
annotation class Ann constructor() : Annotation
|
||||
@field:Ann var x: Int
|
||||
@delegate:Ann var y: Int
|
||||
@@ -0,0 +1,12 @@
|
||||
package test
|
||||
|
||||
annotation class Ann
|
||||
@Ann fun @receiver:Ann Int.foo(@Ann arg: Int) = 10
|
||||
@Ann val @receiver:Ann Int.bar
|
||||
get() = 5
|
||||
|
||||
class A {
|
||||
@Ann fun @receiver:Ann Int.foo(@Ann arg: Int) = 10
|
||||
@Ann val @receiver:Ann Int.bar
|
||||
get() = 5
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class A constructor() {
|
||||
@Ann val @receiver:Ann Int.bar: Int
|
||||
@Ann fun @receiver:Ann Int.foo(@Ann arg: Int): Int
|
||||
}
|
||||
annotation class Ann constructor() : Annotation
|
||||
@Ann val @receiver:Ann Int.bar: Int
|
||||
@Ann fun @receiver:Ann Int.foo(@Ann arg: Int): Int
|
||||
+5
@@ -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) {}
|
||||
+2
@@ -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,23 @@
|
||||
package test;
|
||||
|
||||
abstract class A {
|
||||
abstract val a: Int
|
||||
abstract var b: Int
|
||||
protected set
|
||||
val c: Int = TODO()
|
||||
val d: Int
|
||||
get() = TODO()
|
||||
var e: Int
|
||||
get() = TODO()
|
||||
set(value) = TODO()
|
||||
var f: Int = TODO()
|
||||
private set
|
||||
open val g: Int = TODO()
|
||||
open val h: Int
|
||||
get() = TODO()
|
||||
open var k: Int
|
||||
get() = TODO()
|
||||
set(value) = TODO()
|
||||
open var l: Int = TODO()
|
||||
protected set
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
abstract class A constructor() {
|
||||
abstract val a: Int
|
||||
abstract var b: Int
|
||||
protected set
|
||||
val c: Int
|
||||
val d: Int
|
||||
var e: Int
|
||||
var f: Int
|
||||
private set
|
||||
open val g: Int
|
||||
open val h: Int
|
||||
open var k: Int
|
||||
open var l: Int
|
||||
protected set
|
||||
}
|
||||
@@ -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