// !LANGUAGE: +InlineClasses // IGNORE_BACKEND_FIR: JVM_IR class Outer(val x: X) { inner class Inner(val y: Y) { val hasNull = x == null || y == null fun outerX() = x override fun equals(other: Any?): Boolean = other is Outer<*>.Inner<*> && other.outerX() == x && other.y == y } } inline class Z1(val x: Outer.Inner) inline class Z2(val z: Z1) inline class ZN(val z: Z1?) fun wrap1(xy : Outer.Inner): Z1? = if (xy.hasNull) null else Z1(xy) fun wrap2(xy : Outer.Inner): Z2? = if (xy.hasNull) null else Z2(Z1(xy)) fun wrapN(xy : Outer.Inner): ZN? = if (xy.hasNull) null else ZN(Z1(xy)) fun box(): String { val n = Outer(null).Inner("a") val a = Outer("a").Inner("a") if (wrap1(n) != null) throw AssertionError() if (wrap1(a) == null) throw AssertionError() if (wrap1(a)!!.x != a) throw AssertionError() if (wrap2(n) != null) throw AssertionError() if (wrap2(a) == null) throw AssertionError() if (wrap2(a)!!.z.x != a) throw AssertionError() if (wrapN(n) != null) throw AssertionError() if (wrapN(a) == null) throw AssertionError() if (wrapN(a)!!.z!!.x != a) throw AssertionError() return "OK" }