From 3e564236f9814aad13293cef4d6f470f9103783b Mon Sep 17 00:00:00 2001 From: Svyatoslav Kuzmich Date: Thu, 18 May 2023 10:44:44 +0200 Subject: [PATCH] [Wasm] Fix unsigned types in IR interpreter Wasm kotlin.Any class has properties, additional filtering is required when searching for value class property --- .../org/jetbrains/kotlin/ir/interpreter/CallInterceptor.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/CallInterceptor.kt b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/CallInterceptor.kt index 30ec56d688a..632792a9b9f 100644 --- a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/CallInterceptor.kt +++ b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/CallInterceptor.kt @@ -91,7 +91,9 @@ internal class DefaultCallInterceptor(override val interpreter: IrInterpreter) : irClass.defaultType.isUnsignedType() -> { // Check for type is a hack needed for Native; // in UInt, for example, we may have (after lowerings, I guess) additional property "$companion". - val propertySymbol = irClass.declarations.single { it is IrProperty && it.getter?.returnType?.isPrimitiveType() == true }.symbol + // Check for fake overrides is a hack needed for Wasm; + // in UInt, for example, we may have additional typeInfo and hashCode properties declared in "Any" + val propertySymbol = irClass.declarations.single { it is IrProperty && !it.isFakeOverride && it.getter?.returnType?.isPrimitiveType() == true }.symbol callStack.pushState(receiver.apply { this.setField(propertySymbol, args.single()) }) } else -> defaultAction()