| abstract class ImplicitReceiverStack : Iterable<ImplicitReceiverValue<*>> { |
| constructor() /* primary */ { |
| super/*Any*/() |
| /* <init>() */ |
| |
| } |
| |
| abstract operator fun get(name: String?): ImplicitReceiverValue<*>? |
| |
| } |
| |
| class ImplicitReceiverValue<S : Symbol<*>> : ReceiverValue { |
| val boundSymbol: S? |
| field = boundSymbol |
| get |
| |
| override val type: String |
| field = type |
| override get |
| |
| constructor(boundSymbol: S?, type: String) /* primary */ { |
| super/*Any*/() |
| /* <init>() */ |
| |
| } |
| |
| } |
| |
| class PersistentImplicitReceiverStack : ImplicitReceiverStack, Iterable<ImplicitReceiverValue<*>> { |
| private val stack: List<ImplicitReceiverValue<*>> |
| field = stack |
| private get |
| |
| constructor(stack: List<ImplicitReceiverValue<*>>) /* primary */ { |
| super/*ImplicitReceiverStack*/() |
| /* <init>() */ |
| |
| } |
| |
| override operator fun get(name: String?): ImplicitReceiverValue<*>? { |
| return lastOrNull<ImplicitReceiverValue<*>>(/* <this> = <this>.<get-stack>() */) |
| } |
| |
| override operator fun iterator(): Iterator<ImplicitReceiverValue<*>> { |
| return <this>.<get-stack>().iterator() |
| } |
| |
| } |
| |
| interface ReceiverValue { |
| abstract val type: String |
| abstract get |
| |
| } |
| |
| interface Symbol<E : SymbolOwner<E>> { |
| } |
| |
| interface SymbolOwner<E : SymbolOwner<E>> { |
| } |
| |
| fun bar(s: String) { |
| } |
| |
| fun box(): String { |
| val stack: PersistentImplicitReceiverStack = PersistentImplicitReceiverStack(stack = listOf<ImplicitReceiverValue<Nothing>>(elements = [ImplicitReceiverValue<Nothing>(boundSymbol = null, type = "O"), ImplicitReceiverValue<Nothing>(boundSymbol = null, type = "K")])) |
| foo(stack = stack) |
| return first<ImplicitReceiverValue<*>>(/* <this> = stack */).<get-type>().plus(other = { // BLOCK |
| val tmp_0: ImplicitReceiverValue<*>? = stack.get(name = null) |
| when { |
| EQEQ(arg0 = tmp_0, arg1 = null) -> null |
| else -> tmp_0 /*as ImplicitReceiverValue<*> */.<get-type>() |
| } |
| }) |
| } |
| |
| fun foo(stack: PersistentImplicitReceiverStack) { |
| forEach<ImplicitReceiverValue<*>>(/* <this> = stack, */ action = local fun <anonymous>(it: ImplicitReceiverValue<*>) { |
| it.<get-boundSymbol>() /*~> Unit */ |
| bar(s = it.<get-type>()) |
| } |
| ) |
| } |