@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()) } enum class Enumeration @Marker constructor() { ENTRY(), ENTRY2; } fun foo(some: Some? = null) {} fun test() { val o1 = Other() val o2 = Other(Some(0)) val o3 = Other(444L) foo() foo(null) }