Got a weird puzzler with receivers.
I have a codeblock to which a receiver has been passed. The outer codeblock also has a receiver of the same type. For some reason, when I attempt to call a method on the receiver, it’s calling the outer codeblock’s receiver instead of the inner codeblock’s receiver.
I’ve checked in the debugger and $receiver is the correct inner receiver within the inner codeblock, and yet when the method is called the $receiver within it becomes the outer codeblock’s receiver.
Hope this makes sense, anyone have any ideas?
edit Cleaned up code example and posted to reddit, replies welcome there or here: https://www.reddit.com/r/Kotlin/comments/6kh10d/dsl_receiver_puzzler/