K2 opt-in: restore marker annotation check for constructors

This commit is contained in:
Mikhail Glukhikh
2022-11-21 13:57:11 +01:00
committed by Space Team
parent a77750a257
commit b92ce68f32
7 changed files with 79 additions and 5 deletions
@@ -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)
}