// DONT_TARGET_EXACT_BACKEND: WASM // WASM_MUTE_REASON: SAM_CONVERSIONS // !LANGUAGE: +InlineClasses fun underlying(a: IC): T = bar(a) { it.value as T } fun extension(a: IC): T = bar(a) { it.extensionValue() } fun dispatch(a: IC): T = bar(a) { it.dispatchValue() } fun normal(a: IC): T = bar(a) { normalValue(it) } fun interface FunIFace { fun call(ic: T): R } fun bar(value: T, f: FunIFace): R { return f.call(value) } fun IC.extensionValue(): T = value as T fun normalValue(ic: IC): T = ic.value as T inline class IC(val value: String) { fun dispatchValue(): T = value as T } fun box(): String { var res = underlying(IC("O")) + "K" if (res != "OK") return "FAIL 1: $res" res = extension(IC("O")) + "K" if (res != "OK") return "FAIL 2: $res" res = dispatch(IC("O")) + "K" if (res != "OK") return "FAIL 3: $res" res = normal(IC("O")) + "K" if (res != "OK") return "FAIL 3: $res" return "OK" }