KT-43562 don't remap static inline class funs as special builtins

This commit is contained in:
Dmitry Petrov
2020-11-25 11:54:48 +03:00
parent f6c7372089
commit 498047e64e
14 changed files with 152 additions and 2 deletions
@@ -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");
@@ -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 ||
@@ -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"
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
// IGNORE_ANNOTATIONS
inline class UIntArray(@PublishedApi internal val storage: IntArray) : Collection<UInt> {
override val size: Int get() = TODO()
override operator fun iterator() = TODO()
override fun contains(element: UInt): Boolean = TODO()
override fun containsAll(elements: Collection<UInt>): Boolean = TODO()
override fun isEmpty(): Boolean = TODO()
}
@@ -0,0 +1,38 @@
public final class UIntArray {
// source: 'unsignedArray.kt'
private final field storage: int[]
private synthetic method <init>(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[]
}
@@ -0,0 +1,38 @@
public final class UIntArray {
// source: 'unsignedArray.kt'
private final field storage: int[]
private synthetic method <init>(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[]
}
@@ -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");
@@ -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)
@@ -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");
@@ -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");
@@ -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)
@@ -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");
@@ -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");
@@ -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");