```open class A { open fun somFun(lambda: (sus...
# random
r
Copy code
open class A {
    open fun somFun(lambda: (suspend A.() -> Unit)? = null) = apply { /* ... */ } 
}

class B : A()

class C {
    /**
     * Type mismatch.
     *  Required: B
     *  Found: A
     */
    val b: B = B().somFun { }
}
Is there a way to return B instead of A in
B().somFun { }
without using a static function like below?
Copy code
open class A {
    companion object {
        fun <T : A> T.somFun(lambda: (suspend T.() -> Unit)? = null) = apply { /* ... */ }
    }
}
Like, is there a way to have <out A> in a lambda?