K2 opt-in: restore marker annotation check for constructors
This commit is contained in:
committed by
Space Team
parent
a77750a257
commit
b92ce68f32
+23
@@ -0,0 +1,23 @@
|
||||
// FIR_IDENTICAL
|
||||
@RequiresOptIn
|
||||
annotation class Marker
|
||||
|
||||
@Marker
|
||||
class Some(val x: Int)
|
||||
|
||||
class Other(val x: Int) {
|
||||
@OptIn(Marker::class)
|
||||
constructor(some: Some): this(some.x)
|
||||
|
||||
@Marker
|
||||
constructor(): this(42)
|
||||
|
||||
@OptIn(Marker::class)
|
||||
constructor(y: Long, some: Some? = null): this(some?.x ?: y.toInt())
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val o1 = <!OPT_IN_USAGE_ERROR!>Other<!>()
|
||||
val o2 = Other(<!OPT_IN_USAGE_ERROR!>Some<!>(0))
|
||||
val o3 = Other(444L)
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package
|
||||
|
||||
public fun test(): kotlin.Unit
|
||||
|
||||
@kotlin.RequiresOptIn public final annotation class Marker : kotlin.Annotation {
|
||||
public constructor Marker()
|
||||
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
|
||||
}
|
||||
|
||||
public final class Other {
|
||||
@Marker public constructor Other()
|
||||
@kotlin.OptIn(markerClass = {Marker::class}) public constructor Other(/*0*/ some: Some)
|
||||
public constructor Other(/*0*/ x: kotlin.Int)
|
||||
@kotlin.OptIn(markerClass = {Marker::class}) public constructor Other(/*0*/ y: kotlin.Long, /*1*/ some: Some? = ...)
|
||||
public 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
|
||||
}
|
||||
|
||||
@Marker public final class Some {
|
||||
public constructor Some(/*0*/ x: kotlin.Int)
|
||||
public 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
|
||||
}
|
||||
Reference in New Issue
Block a user