Skip to content

Commit

Permalink
KT-43562 don't remap static inline class funs as special builtins
Browse files Browse the repository at this point in the history
  • Loading branch information
dnpetrov committed Nov 25, 2020
1 parent f6c7372 commit 498047e
Show file tree
Hide file tree
Showing 14 changed files with 152 additions and 2 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down
13 changes: 13 additions & 0 deletions compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
@@ -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()
}
Original file line number Diff line number Diff line change
@@ -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[]
}
Original file line number Diff line number Diff line change
@@ -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[]
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 498047e

Please sign in to comment.