Value classes: treat @JvmInline value classes as inline classes
Report error on value classes without @JvmInline annotation. Do not check for @JvmInline annotation in value classes since it breaks reflection.
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
package kotlin
|
||||
|
||||
annotation class JvmInline
|
||||
|
||||
@JvmInline
|
||||
value class X(val x: Int)
|
||||
@JvmInline
|
||||
value class Z(val x: Int)
|
||||
|
||||
class TestOk1(val a: Int, val b: Int) {
|
||||
constructor(x: X) : this(x.x, 1)
|
||||
}
|
||||
|
||||
class TestErr1(val a: Int) {
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>constructor(x: X)<!> : this(x.x)
|
||||
}
|
||||
|
||||
class <!CONFLICTING_JVM_DECLARATIONS!>TestErr2(val a: Int, val b: Int)<!> {
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>constructor(x: X)<!> : this(x.x, 1)
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>constructor(z: Z)<!> : this(z.x, 2)
|
||||
}
|
||||
Reference in New Issue
Block a user