agoda-com/Kakao

Can't be called in this context by implicit receiver

Closed this issue · 3 comments

On a new 2.0.0 AndroidX version of the lib, the following code gives a compilation error:
val lol Can't be called in this context by implicit receiver. Use explicit one if necessary

val lol = "text"
val view = KTextView { containsText(lol) }

It is fixable by adding this@ClassName.lol to a lol val.
But I'm kinda missing what has changed since 2.0.0 that I can't use an implicit receiver anymore.
I have dozens of similar cases using the ViewBuilder, and after migration to AndroidX and 2.0.0 all of them require adding an explicit receiver.

Can you please clarify what's happening here and potentially fix it?

Hi there! First of all, thanks for using the lib.
In the 2.0.0 release we fixed the behavior of the DslMarker annotations and that's basically the expected behaviour. This is done to protect users from accidentaly using functions in the outer receivers while writing the tests using DSL and thus resulting in unexpected behaviour.
This is default Kotlin's behaviour with usage of DslMarkers. If this is causing troubles, let's discuss how we can improve on that.

Got it. Thank you for clarification.

Closing this issue as the questions has been answered.