``` fun foo(a: ClassA) { val b: ClassA.ClassB ...
# getting-started
o
Copy code
fun foo(a: ClassA) {
    val b: ClassA.ClassB = with(a) {
        object : ClassA.ClassB() {

        }
    }
    println(b)
}
Given the above code, IDEA does not complain, but the compiler throws an internal error when trying to compile it. This may be a bug...
a
okkero:
ClassA.ClassB()
is not possible at all. you need an instance of
ClassA
to create a
ClassB
o
Yes. Hence the
with(a)
. In the lambda following it the receiver is an instance of
ClassA
. This should not be a problem.
a
so where does
object: ClassA.ClassB()
get the instance from? implicitly?
o
Yes. I would expect so. But the point is that the compiler throws an internal error trying to compile it
a
yeah, if IDEA doesnt complain and the compiler produces an exception, you should report it