diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 500f8d943e2..ce36177dc77 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -32046,6 +32046,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/unsignedTypes/nullableUnsignedEqualsLiteral.kt"); } + @TestMetadata("unsignedArraySize.kt") + public void testUnsignedArraySize() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt"); + } + @TestMetadata("unsignedIntCompare.kt") public void testUnsignedIntCompare() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/unsignedIntCompare.kt"); diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt index 5ad6d6c6fd8..3a76c6f47ac 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt @@ -427,8 +427,14 @@ class MethodSignatureMapper(private val context: JvmBackendContext) { return current } - private fun getJvmMethodNameIfSpecial(irFunction: IrSimpleFunction): String? = - irFunction.getBuiltinSpecialPropertyGetterName() ?: irFunction.getDifferentNameForJvmBuiltinFunction() + private fun getJvmMethodNameIfSpecial(irFunction: IrSimpleFunction): String? { + if (irFunction.origin == JvmLoweredDeclarationOrigin.STATIC_INLINE_CLASS_REPLACEMENT) { + return null + } + + return irFunction.getBuiltinSpecialPropertyGetterName() + ?: irFunction.getDifferentNameForJvmBuiltinFunction() + } private val IrSimpleFunction.isBuiltIn: Boolean get() = getPackageFragment()?.fqName == StandardNames.BUILT_INS_PACKAGE_FQ_NAME || diff --git a/compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt b/compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt new file mode 100644 index 00000000000..195b143ce92 --- /dev/null +++ b/compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt @@ -0,0 +1,13 @@ +// DONT_TARGET_EXACT_BACKEND: WASM +// WASM_MUTE_REASON: STDLIB_COLLECTIONS +// KJS_WITH_FULL_RUNTIME +// WITH_RUNTIME +// IGNORE_BACKEND_FIR: JVM_IR + +fun test() = uintArrayOf(1u).size + +fun box(): String { + val test = test() + if (test != 1) return "Failed: $test" + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray.kt b/compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray.kt new file mode 100644 index 00000000000..ca6959fb370 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray.kt @@ -0,0 +1,10 @@ +// WITH_RUNTIME +// IGNORE_ANNOTATIONS + +inline class UIntArray(@PublishedApi internal val storage: IntArray) : Collection { + override val size: Int get() = TODO() + override operator fun iterator() = TODO() + override fun contains(element: UInt): Boolean = TODO() + override fun containsAll(elements: Collection): Boolean = TODO() + override fun isEmpty(): Boolean = TODO() +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray.txt b/compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray.txt new file mode 100644 index 00000000000..e2fb6af2510 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray.txt @@ -0,0 +1,38 @@ +public final class UIntArray { + // source: 'unsignedArray.kt' + private final field storage: int[] + private synthetic method (p0: int[]): void + public synthetic method add(p0: java.lang.Object): boolean + public method add-WZ4Q5Ns(p0: int): boolean + public method addAll(p0: java.util.Collection): boolean + public synthetic final static method box-impl(p0: int[]): UIntArray + public method clear(): void + public static method constructor-impl(p0: int[]): int[] + public bridge final method contains(p0: java.lang.Object): boolean + public method contains-WZ4Q5Ns(p0: int): boolean + public static method contains-WZ4Q5Ns(p0: int[], p1: int): boolean + public method containsAll(p0: java.util.Collection): boolean + public static method containsAll-impl(p0: int[], p1: java.util.Collection): boolean + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: int[], p1: java.lang.Object): boolean + public final static method equals-impl0(p0: int[], p1: int[]): boolean + public method getSize(): int + public static method getSize-impl(p0: int[]): int + public synthetic deprecated static method getStorage$annotations(): void + public method hashCode(): int + public static method hashCode-impl(p0: int[]): int + public method isEmpty(): boolean + public static method isEmpty-impl(p0: int[]): boolean + public method iterator(): java.lang.Void + public synthetic bridge method iterator(): java.util.Iterator + public static method iterator-impl(p0: int[]): java.lang.Void + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] + public method toString(): java.lang.String + public static method toString-impl(p0: int[]): java.lang.String + public synthetic final method unbox-impl(): int[] +} diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray_ir.txt b/compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray_ir.txt new file mode 100644 index 00000000000..a42fe476c10 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray_ir.txt @@ -0,0 +1,38 @@ +public final class UIntArray { + // source: 'unsignedArray.kt' + private final field storage: int[] + private synthetic method (p0: int[]): void + public synthetic bridge method add(p0: java.lang.Object): boolean + public method add-WZ4Q5Ns(p0: int): boolean + public method addAll(p0: java.util.Collection): boolean + public synthetic final static method box-impl(p0: int[]): UIntArray + public method clear(): void + public static method constructor-impl(p0: int[]): int[] + public synthetic bridge method contains(p0: java.lang.Object): boolean + public method contains-WZ4Q5Ns(p0: int): boolean + public static method contains-WZ4Q5Ns(p0: int[], p1: int): boolean + public method containsAll(p0: java.util.Collection): boolean + public static method containsAll-impl(p0: int[], p1: java.util.Collection): boolean + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: int[], p1: java.lang.Object): boolean + public final static method equals-impl0(p0: int[], p1: int[]): boolean + public method getSize(): int + public static method getSize-impl(p0: int[]): int + public synthetic deprecated static method getStorage$annotations(): void + public method hashCode(): int + public static method hashCode-impl(p0: int[]): int + public method isEmpty(): boolean + public static method isEmpty-impl(p0: int[]): boolean + public method iterator(): java.lang.Void + public synthetic bridge method iterator(): java.util.Iterator + public static method iterator-impl(p0: int[]): java.lang.Void + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public synthetic bridge method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] + public method toString(): java.lang.String + public static method toString-impl(p0: int[]): java.lang.String + public synthetic final method unbox-impl(): int[] +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 0f2bb3db218..53ecbd37c55 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -33817,6 +33817,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/unsignedTypes/nullableUnsignedEqualsLiteral.kt"); } + @TestMetadata("unsignedArraySize.kt") + public void testUnsignedArraySize() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt"); + } + @TestMetadata("unsignedIntCompare.kt") public void testUnsignedIntCompare() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/unsignedIntCompare.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 5b6cc7ce033..3819622fa50 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -1510,6 +1510,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/specialBridges/removeAtTwoSpecialBridges.kt"); } + @TestMetadata("unsignedArray.kt") + public void testUnsignedArray() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray.kt"); + } + @TestMetadata("compiler/testData/codegen/bytecodeListing/specialBridges/signatures") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 133cec36ca8..b0dd00e8126 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -31451,6 +31451,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/unsignedTypes/nullableUnsignedEqualsLiteral.kt"); } + @TestMetadata("unsignedArraySize.kt") + public void testUnsignedArraySize() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt"); + } + @TestMetadata("unsignedIntCompare.kt") public void testUnsignedIntCompare() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/unsignedIntCompare.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 44178290ef3..a34cf8c8247 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -32046,6 +32046,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/unsignedTypes/nullableUnsignedEqualsLiteral.kt"); } + @TestMetadata("unsignedArraySize.kt") + public void testUnsignedArraySize() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt"); + } + @TestMetadata("unsignedIntCompare.kt") public void testUnsignedIntCompare() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/unsignedIntCompare.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 5cdf9872f30..cd94d0bd371 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -1480,6 +1480,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/specialBridges/removeAtTwoSpecialBridges.kt"); } + @TestMetadata("unsignedArray.kt") + public void testUnsignedArray() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/specialBridges/unsignedArray.kt"); + } + @TestMetadata("compiler/testData/codegen/bytecodeListing/specialBridges/signatures") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 532559db1f0..fc028038110 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -26012,6 +26012,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/unsignedTypes/nullableUnsignedEqualsLiteral.kt"); } + @TestMetadata("unsignedArraySize.kt") + public void testUnsignedArraySize() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt"); + } + @TestMetadata("unsignedIntCompare.kt") public void testUnsignedIntCompare() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/unsignedIntCompare.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 05738d7f7ab..330d600d2da 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -26012,6 +26012,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/unsignedTypes/nullableUnsignedEqualsLiteral.kt"); } + @TestMetadata("unsignedArraySize.kt") + public void testUnsignedArraySize() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt"); + } + @TestMetadata("unsignedIntCompare.kt") public void testUnsignedIntCompare() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/unsignedIntCompare.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index aac27644c42..1b86ccfe43b 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -26027,6 +26027,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/unsignedTypes/nullableUnsignedEqualsLiteral.kt"); } + @TestMetadata("unsignedArraySize.kt") + public void testUnsignedArraySize() throws Exception { + runTest("compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt"); + } + @TestMetadata("unsignedIntCompare.kt") public void testUnsignedIntCompare() throws Exception { runTest("compiler/testData/codegen/box/unsignedTypes/unsignedIntCompare.kt");