Hi all, I'm trying to figure out why I can't refer...
# announcements
a
Hi all, I'm trying to figure out why I can't reference an outer class's
this
for a lambda with a receiver. Here's a code snippet https://pl.kotl.in/GtgL1DMFc . Based on https://kotlinlang.org/docs/reference/this-expressions.html it seems like I should be able to reference the outer
this
via a label, so why can't the compiler resolve the
@A
reference? Thanks!
d
You are trying to reference the
this
of
value
, not the
this
of
A
(your function doesn't have an outer
A
). So
this@value
is what you want.
👏 1
a
Thank you so much!
Ah, but
this@value::doSomething
fails because its receiver is not
CoroutineScope
. Oh well.
r
Yeah, there isn't support for multiple receivers is Kotlin. Hopefully someday, as it would make some DSLs extra slick.