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)
|
||||
}
|
||||
Reference in New Issue
Block a user