JVM IR: add module name for internal functions before "$default"
The change is a bit complicated because the name mapping logic is refactored so that we would compute the needed suffix first (either module name, or multifile part class name), and then shove it into the mangled name between the original function name and "$default", if the function in question is the default arguments adapter. The main motivation for this change was to fix KT-41809, but as a side effect, private functions with default arguments in multifile parts now also contain the file name, just like normal private functions. #KT-41809 Fixed
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
package test
|
||||
|
||||
class A internal constructor(a: Int = 0) {
|
||||
internal fun internalFunction(b: String = "") {}
|
||||
|
||||
@JvmName("internalJvmNameFunction")
|
||||
internal fun f(c: String = "") {}
|
||||
|
||||
public fun publicFunction(d: String = "") {}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
@kotlin.Metadata
|
||||
public final class test/A {
|
||||
// source: 'internalNameMangling.kt'
|
||||
public method <init>(): void
|
||||
public method <init>(p0: int): void
|
||||
public synthetic method <init>(p0: int, p1: int, p2: kotlin.jvm.internal.DefaultConstructorMarker): void
|
||||
public synthetic static method internalFunction$test_module$default(p0: test.A, p1: java.lang.String, p2: int, p3: java.lang.Object): void
|
||||
public final method internalFunction$test_module(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public synthetic static method internalJvmNameFunction$default(p0: test.A, p1: java.lang.String, p2: int, p3: java.lang.Object): void
|
||||
public final @kotlin.jvm.JvmName method internalJvmNameFunction(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public synthetic static method publicFunction$default(p0: test.A, p1: java.lang.String, p2: int, p3: java.lang.Object): void
|
||||
public final method publicFunction(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
// The remaining differences of JVM and JVM_IR here are reported at KT-36970, KT-41841.
|
||||
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("A")
|
||||
|
||||
private fun foo(x: String = "") {}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
@kotlin.Metadata
|
||||
public final class A {
|
||||
// source: 'privateFunctionInMultifilePart.kt'
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
synthetic final class A__PrivateFunctionInMultifilePartKt {
|
||||
// source: 'privateFunctionInMultifilePart.kt'
|
||||
synthetic static method foo$A__PrivateFunctionInMultifilePartKt$default(p0: java.lang.String, p1: int, p2: java.lang.Object): void
|
||||
private final static method foo$A__PrivateFunctionInMultifilePartKt(p0: java.lang.String): void
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
@kotlin.Metadata
|
||||
public final class A {
|
||||
// source: 'privateFunctionInMultifilePart.kt'
|
||||
final static method foo$A__PrivateFunctionInMultifilePartKt$default(@org.jetbrains.annotations.Nullable p0: java.lang.String, p1: int, p2: java.lang.Object): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
@kotlin.jvm.JvmName
|
||||
synthetic final class A__PrivateFunctionInMultifilePartKt {
|
||||
// source: 'privateFunctionInMultifilePart.kt'
|
||||
synthetic static method foo$A__PrivateFunctionInMultifilePartKt$default(p0: java.lang.String, p1: int, p2: java.lang.Object): void
|
||||
private final static method foo$A__PrivateFunctionInMultifilePartKt(p0: java.lang.String): void
|
||||
}
|
||||
Reference in New Issue
Block a user