class Outer(val x: T) { open inner class Inner(val y: Int) } fun Outer.test() = object : Outer.Inner(42) { val xx = x + y }