Mangle function names with inline class parameters

Avoid name clashes in cases such as

  inline class Login(val login: String)
  inline class Password(val password: String)

  fun validate(login: Login) { ... }
  fun validate(password: Password) { ... }
This commit is contained in:
Dmitry Petrov
2018-08-15 10:25:49 +03:00
committed by Ilya Gorbunov
parent ff9ba97d66
commit a56d1d3ce8
45 changed files with 1273 additions and 30 deletions
@@ -1082,6 +1082,11 @@ public class KotlinTypeMapper {
return name;
}
String manglingSuffix = InlineClassManglingUtilsKt.getInlineClassValueParametersManglingSuffix(descriptor);
if (manglingSuffix != null) {
name += "$" + manglingSuffix;
}
if (DescriptorUtils.isTopLevelDeclaration(descriptor)) {
if (Visibilities.isPrivate(descriptor.getVisibility()) && !(descriptor instanceof ConstructorDescriptor) && !"<clinit>".equals(name)) {
String partName = getPartSimpleNameForMangling(descriptor);
@@ -0,0 +1,69 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen.state
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.load.kotlin.getRepresentativeUpperBound
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
import org.jetbrains.kotlin.resolve.isInlineClassType
import org.jetbrains.kotlin.types.KotlinType
import java.security.MessageDigest
fun getInlineClassValueParametersManglingSuffix(descriptor: CallableMemberDescriptor): String? {
if (descriptor !is FunctionDescriptor) return null
if (descriptor is ConstructorDescriptor) return null
val actualValueParameterTypes = listOfNotNull(descriptor.extensionReceiverParameter?.type) + descriptor.valueParameters.map { it.type }
if (actualValueParameterTypes.none { it.isInlineClassType() || it.isTypeParameterWithInlineClassUpperBound() }) return null
return md5radix36string(collectSignatureForMangling(actualValueParameterTypes))
}
private fun collectSignatureForMangling(types: List<KotlinType>) =
types.joinToString { getSignatureElementForMangling(it) }
private fun getSignatureElementForMangling(type: KotlinType): String = buildString {
val descriptor = type.constructor.declarationDescriptor ?: return ""
when (descriptor) {
is ClassDescriptor -> {
append('L')
append(descriptor.fqNameUnsafe)
if (type.isMarkedNullable) append('?')
append(';')
}
is TypeParameterDescriptor -> {
append(getSignatureElementForMangling(getRepresentativeUpperBound(descriptor)))
}
}
}
private fun md5radix36string(signatureForMangling: String): String {
val d = MessageDigest.getInstance("MD5").digest(signatureForMangling.toByteArray())
var acc = 0L
for (i in 0..4) {
acc = (acc shl 8) + (d[i].toLong() and 0xFFL)
}
return acc.toString(36)
}
fun KotlinType.isTypeParameterWithInlineClassUpperBound(): Boolean {
val descriptor = constructor.declarationDescriptor as? TypeParameterDescriptor ?: return false
return descriptor.isWithInlineClassUpperBoundInner(hashSetOf(descriptor))
}
private fun TypeParameterDescriptor.isWithInlineClassUpperBoundInner(visited: MutableSet<TypeParameterDescriptor>): Boolean {
for (type in typeConstructor.supertypes) {
if (type.isInlineClassType()) return true
val typeParameterDescriptor = type.constructor.declarationDescriptor as? TypeParameterDescriptor ?: continue
if (!visited.add(typeParameterDescriptor)) continue
if (typeParameterDescriptor.isWithInlineClassUpperBoundInner(visited)) return true
}
return false
}
@@ -0,0 +1,13 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
inline class S(val string: String)
fun foo(s: S): String {
val anon = object {
fun bar() = s.string
}
return anon.bar()
}
fun box() = foo(S("OK"))
@@ -0,0 +1,50 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
inline class Id(val id: String)
inline class Name(val name: String)
inline class Password(val password: String)
fun Id.test() {
if (id != "OK") throw AssertionError()
}
fun Name.test() {
if (name != "OK") throw AssertionError()
}
fun test(password: Password) {
if (password.password != "OK") throw AssertionError()
}
class Outer {
fun Id.testExn() {
if (id != "OK") throw AssertionError()
}
fun Name.testExn() {
if (name != "OK") throw AssertionError()
}
fun testExn(password: Password) {
if (password.password != "OK") throw AssertionError()
}
fun testExns() {
Id("OK").testExn()
Name("OK").testExn()
testExn(Password("OK"))
}
}
fun box(): String {
Id("OK").test()
Name("OK").test()
test(Password("OK"))
Outer().testExns()
return "OK"
}
@@ -0,0 +1,19 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
inline class Id(val id: String)
fun test(id: Id) {
if (id.id != "OK") throw AssertionError()
}
fun test(id: Id?) {
if (id != null) throw AssertionError()
}
fun box(): String {
test(Id("OK"))
test(null)
return "OK"
}
@@ -0,0 +1,23 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
inline class S1(val s1: String)
inline class S2(val s2: String)
object X1
object X2
fun <T> test(s1: S1, x: T) {
if (s1.s1 != "OK" && x != X1) throw AssertionError()
}
fun <T> test(s2: S2, x: T) {
if (s2.s2 != "OK" && x != X2) throw AssertionError()
}
fun box(): String {
test(S1("OK"), X1)
test(S2("OK"), X2)
return "OK"
}
@@ -0,0 +1,13 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
inline class S(val string: String)
fun foo(s: S): String {
class Local {
fun bar() = s.string
}
return Local().bar()
}
fun box() = foo(S("OK"))
@@ -0,0 +1,89 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
inline class Id(val id: String)
inline class Name(val name: String)
interface IA {
fun fromInterface(id: Id)
fun fromInterface(name: Name)
fun fromBoth(id: Id)
fun fromBoth(name: Name)
fun withDefaultImpl(id: Id) {
if (id.id != "OK") throw AssertionError()
}
fun withDefaultImpl(name: Name) {
if (name.name != "OK") throw AssertionError()
}
}
abstract class Base {
abstract fun fromClass(id: Id)
abstract fun fromClass(name: Name)
abstract fun fromBoth(id: Id)
abstract fun fromBoth(name: Name)
}
class C : Base(), IA {
override fun fromInterface(id: Id) {
if (id.id != "OK") throw AssertionError()
}
override fun fromInterface(name: Name) {
if (name.name != "OK") throw AssertionError()
}
override fun fromClass(id: Id) {
if (id.id != "OK") throw AssertionError()
}
override fun fromClass(name: Name) {
if (name.name != "OK") throw AssertionError()
}
override fun fromBoth(id: Id) {
if (id.id != "OK") throw AssertionError()
}
override fun fromBoth(name: Name) {
if (name.name != "OK") throw AssertionError()
}
}
fun testIA(a: IA) {
a.fromInterface(Id("OK"))
a.fromInterface(Name("OK"))
a.fromBoth(Id("OK"))
a.fromBoth(Name("OK"))
a.withDefaultImpl(Id("OK"))
a.withDefaultImpl(Name("OK"))
}
fun testBase(b: Base) {
b.fromClass(Id("OK"))
b.fromClass(Name("OK"))
b.fromBoth(Id("OK"))
b.fromBoth(Name("OK"))
}
fun testC(c: C) {
c.withDefaultImpl(Id("OK"))
c.withDefaultImpl(Name("OK"))
}
fun box(): String {
testIA(C())
testBase(C())
testC(C())
return "OK"
}
@@ -0,0 +1,28 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
inline class Id(val id: String)
inline class Name(val name: String)
inline class Password(val password: String)
fun test(id: Id) {
if (id.id != "OK") throw AssertionError()
}
fun test(name: Name) {
if (name.name != "OK") throw AssertionError()
}
fun test(password: Password) {
if (password.password != "OK") throw AssertionError()
}
fun box(): String {
test(Id("OK"))
test(Name("OK"))
test(Password("OK"))
return "OK"
}
@@ -0,0 +1,35 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR, JS, JS_IR
// FULL_JDK
// WITH_RUNTIME
inline class Id(val id: String)
fun throws() {
throw RuntimeException()
}
fun test(id: Id) {
throws()
}
fun foo() {
test(Id("id"))
}
fun box(): String {
val stackTrace = try {
foo()
throw AssertionError()
} catch (e: RuntimeException) {
e.stackTrace
}
for (entry in stackTrace) {
if (entry.methodName.startsWith("test$")) {
return "OK"
}
}
throw AssertionError()
}
@@ -0,0 +1,19 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
inline class Id(val id: String)
fun test(id: Id, str: String) {
if (id.id != "OK" && str != "1") throw AssertionError()
}
fun test(str: String, id: Id) {
if (id.id != "OK" && str != "2") throw AssertionError()
}
fun box(): String {
test(Id("OK"), "1")
test("2", Id("OK"))
return "OK"
}
@@ -0,0 +1,14 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
abstract class GenericBase<T> {
abstract fun foo(x: T): T
}
inline class Str(val str: String)
class Derived : GenericBase<Str>() {
override fun foo(x: Str): Str = x
}
fun box() = Derived().foo(Str("OK")).str
@@ -0,0 +1,24 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
abstract class GenericBase<T> {
abstract fun foo(x: T): T
}
interface IFoo {
fun foo(x: String): String
}
inline class Str(val str: String)
class Derived : GenericBase<Str>(), IFoo {
override fun foo(x: Str): Str = x
override fun foo(x: String): String = x
}
fun box(): String {
if (Derived().foo(Str("OK")).str != "OK") throw AssertionError()
if (Derived().foo("OK") != "OK") throw AssertionError()
return "OK"
}
@@ -0,0 +1,14 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
inline class Str(val string: String)
class C {
var s = Str("")
}
fun box(): String {
val x = C()
x.s = Str("OK")
return x.s.string
}
@@ -0,0 +1,17 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR, JS, JS_IR
// WITH_RUNTIME
import kotlin.test.*
inline class S(val string: String)
fun foo(s: S) = s
fun box(): String {
val fooRef = ::foo
assertEquals("abc", fooRef.invoke(S("abc")).string)
assertEquals("foo", fooRef.name)
return "OK"
}
@@ -0,0 +1,26 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR, JS, JS_IR
// WITH_REFLECT
import kotlin.test.*
import kotlin.test.*
inline class S(val string: String)
fun test(s: S) {
class Local
val localKClass = Local::class
val localJClass = localKClass.java
assertEquals("test\$Local", localKClass.simpleName)
assertTrue { localJClass.isLocalClass }
assertEquals("test\$Local", localJClass.simpleName)
}
fun box(): String {
test(S(""))
return "OK"
}
@@ -0,0 +1,21 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR, JS, JS_IR
// WITH_RUNTIME
import kotlin.test.*
inline class S(val string: String)
var prop = S("")
fun box(): String {
val propRef = ::prop
assertEquals(S(""), propRef.get())
propRef.set(S("abc"))
assertEquals(S("abc"), propRef.get())
assertEquals("prop", propRef.name)
return "OK"
}
@@ -0,0 +1,14 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
inline class S(val string: String)
class Outer {
private fun foo(s: S) = s.string
inner class Inner(val string: String) {
fun bar() = foo(S(string))
}
}
fun box(): String = Outer().Inner("OK").bar()
@@ -0,0 +1,18 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
inline class S(val string: String)
class Outer {
private var pr = S("")
inner class Inner() {
fun updateOuter(string: String): String {
pr = S(string)
return pr.string
}
}
}
fun box(): String =
Outer().Inner().updateOuter("OK")
@@ -14,5 +14,5 @@ inline class Foo(val x: Int) {
// 1 INVOKESTATIC Foo\$Erased.empty \(I\)V
// 1 INVOKESTATIC Foo\$Erased.withParam \(ILjava/lang/String;\)V
// 1 INVOKESTATIC Foo\$Erased.withInlineClassParam \(II\)V
// 1 INVOKESTATIC Foo\$Erased.withInlineClassParam\$1e4ch6lh \(II\)V
// 5 INVOKEVIRTUAL
@@ -0,0 +1,10 @@
// !LANGUAGE: +InlineClasses
inline class Str(val s: String)
class C1(val ss: Str)
class C2(val ss1: Str, val ss2: Str)
// 2 public \<init\>\(Ljava/lang/String;\)V
// 1 public \<init\>\(Ljava/lang/String;Ljava/lang/String;\)V
@@ -0,0 +1,29 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
inline class Id(val id: String)
inline class Name(val name: String)
inline class Password(val password: String)
fun test(id: Id) {
if (id.id != "OK") throw AssertionError()
}
fun test(id: Id?) {
if (id != null) throw AssertionError()
}
fun test(name: Name) {
if (name.name != "OK") throw AssertionError()
}
fun test(password: Password) {
if (password.password != "OK") throw AssertionError()
}
// 1 public final static test\$9zx0e0j9\(Ljava/lang/String;\)V
// 1 public final static test\$79jv2l6i\(Ljava/lang/String;\)V
// 1 public final static test\$d4pejdz3\(Ljava/lang/String;\)V
// 1 public final static test\$c6sgoxk6\(Ljava/lang/String;\)V
@@ -0,0 +1,10 @@
// !LANGUAGE: +InlineClasses
inline class Str(val string: String)
class C {
var s = Str("")
}
// 1 public final getS\(\)Ljava/lang/String;
// 1 public final setS\$90215lrx\(Ljava/lang/String;\)V
@@ -0,0 +1,37 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_PARAMETER
inline class X(val x: Int)
inline class Z(val x: Int)
inline class Str(val str: String)
inline class Name(val name: String)
inline class NStr(val str: String?)
fun testSimple(x: X) {}
fun testSimple(z: Z) {}
fun testMixed(x: Int, y: Int) {}
fun testMixed(x: X, y: Int) {}
fun testMixed(x: Int, y: X) {}
fun testMixed(x: X, y: X) {}
fun testNewType(s: Str) {}
fun testNewType(name: Name) {}
fun testNullableVsNonNull1(s: Str) {}
fun testNullableVsNonNull1(s: Str?) {}
fun testNullableVsNonNull2(ns: NStr) {}
fun testNullableVsNonNull2(ns: NStr?) {}
<!CONFLICTING_JVM_DECLARATIONS!>fun testFunVsExt(x: X)<!> {}
<!CONFLICTING_JVM_DECLARATIONS!>fun X.testFunVsExt()<!> {}
<!CONFLICTING_JVM_DECLARATIONS!>fun testNonGenericVsGeneric(x: X, y: Number)<!> {}
<!CONFLICTING_JVM_DECLARATIONS!>fun <T : Number> testNonGenericVsGeneric(x: X, y: T)<!> {}
class C<TC : Number> {
<!CONFLICTING_JVM_DECLARATIONS!>fun testNonGenericVsGeneric(x: X, y: Number)<!> {}
<!CONFLICTING_JVM_DECLARATIONS!>fun <T : Number> testNonGenericVsGeneric(x: X, y: T)<!> {}
<!CONFLICTING_JVM_DECLARATIONS!>fun testNonGenericVsGeneric(x: X, y: TC)<!> {}
}
@@ -0,0 +1,68 @@
package
public fun testFunVsExt(/*0*/ x: X): kotlin.Unit
public fun testMixed(/*0*/ x: X, /*1*/ y: X): kotlin.Unit
public fun testMixed(/*0*/ x: X, /*1*/ y: kotlin.Int): kotlin.Unit
public fun testMixed(/*0*/ x: kotlin.Int, /*1*/ y: X): kotlin.Unit
public fun testMixed(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int): kotlin.Unit
public fun testNewType(/*0*/ name: Name): kotlin.Unit
public fun testNewType(/*0*/ s: Str): kotlin.Unit
public fun </*0*/ T : kotlin.Number> testNonGenericVsGeneric(/*0*/ x: X, /*1*/ y: T): kotlin.Unit
public fun testNonGenericVsGeneric(/*0*/ x: X, /*1*/ y: kotlin.Number): kotlin.Unit
public fun testNullableVsNonNull1(/*0*/ s: Str): kotlin.Unit
public fun testNullableVsNonNull1(/*0*/ s: Str?): kotlin.Unit
public fun testNullableVsNonNull2(/*0*/ ns: NStr): kotlin.Unit
public fun testNullableVsNonNull2(/*0*/ ns: NStr?): kotlin.Unit
public fun testSimple(/*0*/ x: X): kotlin.Unit
public fun testSimple(/*0*/ z: Z): kotlin.Unit
public fun X.testFunVsExt(): kotlin.Unit
public final class C</*0*/ TC : kotlin.Number> {
public constructor C</*0*/ TC : kotlin.Number>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final fun </*0*/ T : kotlin.Number> testNonGenericVsGeneric(/*0*/ x: X, /*1*/ y: T): kotlin.Unit
public final fun testNonGenericVsGeneric(/*0*/ x: X, /*1*/ y: TC): kotlin.Unit
public final fun testNonGenericVsGeneric(/*0*/ x: X, /*1*/ y: kotlin.Number): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final inline class NStr {
public constructor NStr(/*0*/ str: kotlin.String?)
public final val str: kotlin.String?
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public final inline class Name {
public constructor Name(/*0*/ name: kotlin.String)
public final val name: kotlin.String
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public final inline class Str {
public constructor Str(/*0*/ str: kotlin.String)
public final val str: kotlin.String
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public final inline class X {
public constructor X(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public final inline class Z {
public constructor Z(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@@ -0,0 +1,14 @@
// !LANGUAGE: +InlineClasses
inline class Name(val name: String)
inline class Password(val password: String)
interface NameVerifier {
fun verify(name: Name)
}
interface PasswordVerifier {
fun verify(password: Password)
}
interface NameAndPasswordVerifier : NameVerifier, PasswordVerifier
@@ -0,0 +1,39 @@
package
public final inline class Name {
public constructor Name(/*0*/ name: kotlin.String)
public final val name: kotlin.String
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public interface NameAndPasswordVerifier : NameVerifier, PasswordVerifier {
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
public abstract override /*1*/ /*fake_override*/ fun verify(/*0*/ name: Name): kotlin.Unit
public abstract override /*1*/ /*fake_override*/ fun verify(/*0*/ password: Password): kotlin.Unit
}
public interface NameVerifier {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public abstract fun verify(/*0*/ name: Name): kotlin.Unit
}
public final inline class Password {
public constructor Password(/*0*/ password: kotlin.String)
public final val password: kotlin.String
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public interface PasswordVerifier {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public abstract fun verify(/*0*/ password: Password): kotlin.Unit
}
@@ -25,6 +25,6 @@ inline class Foo(val x: Int) {
// jvm signature: (ILjava/lang/Object;D)V
// generic signature: null
// method: Foo$Erased::withInlineClassType
// method: Foo$Erased::withInlineClassType$1e4ch6lh
// jvm signature: (II)V
// generic signature: null
@@ -9,15 +9,15 @@ object Test {
fun nullableValue(f: Foo<Long>?) {}
}
// method: Test::nonNullTypeArgument
// method: Test::nonNullTypeArgument$1e4ch6lh
// jvm signature: (Ljava/util/List;)V
// generic signature: (Ljava/util/List<Ljava/lang/Integer;>;)V
// method: Test::nullableTypeArgument
// method: Test::nullableTypeArgument$1e4ch6lh
// jvm signature: (Ljava/util/List;)V
// generic signature: (Ljava/util/List<Ljava/lang/String;>;)V
// method: Test::nullableValue
// method: Test::nullableValue$31ee2c96
// jvm signature: (Ljava/util/List;)V
// generic signature: (Ljava/util/List<Ljava/lang/Long;>;)V
@@ -15,23 +15,23 @@ object Test {
fun asNullableAndNullableTypeArgument(a: Default<Int?>?) {}
}
// method: Test::withNotNullPrimitive
// method: Test::withNotNullPrimitive$7odoyk9m
// jvm signature: (Ljava/lang/Object;)V
// generic signature: null
// method: Test::withAdditionalGenericParameter
// method: Test::withAdditionalGenericParameter$1k09dck1
// jvm signature: (LInv;Ljava/lang/Object;)V
// generic signature: (LInv<Ljava/lang/String;>;Ljava/lang/Object;)V
// method: Test::asNullable
// method: Test::asNullable$ao7usvyu
// jvm signature: (LDefault;)V
// generic signature: (LDefault<Ljava/lang/Integer;>;)V
// method: Test::asNullableTypeArgument
// method: Test::asNullableTypeArgument$7odoyk9m
// jvm signature: (Ljava/lang/Object;)V
// generic signature: null
// method: Test::asNullableAndNullableTypeArgument
// method: Test::asNullableAndNullableTypeArgument$ao7usvyu
// jvm signature: (LDefault;)V
// generic signature: (LDefault<Ljava/lang/Integer;>;)V
@@ -14,18 +14,18 @@ object Test {
fun asNullableForNullableValue(a: NullableValue<Int>?) {}
}
// method: Test::withNotNullPrimitive
// method: Test::withNotNullPrimitive$7l8qu2mt
// jvm signature: (Ljava/lang/Object;)V
// generic signature: null
// method: Test::asNullable
// method: Test::asNullable$4hed6sie
// jvm signature: (Ljava/lang/Object;)V
// generic signature: null
// method: Test::withNotNullForNullableValue
// method: Test::withNotNullForNullableValue$c6wvqrdl
// jvm signature: (Ljava/lang/Object;)V
// generic signature: null
// method: Test::asNullableForNullableValue
// method: Test::asNullableForNullableValue$aloai6d9
// jvm signature: (LNullableValue;)V
// generic signature: (LNullableValue<Ljava/lang/Integer;>;)V
@@ -8,7 +8,7 @@ object Test {
fun listOfFoo(f: List<Foo>) {}
}
// method: Test::simple
// method: Test::simple$1e4ch6lh
// jvm signature: (I)V
// generic signature: null
@@ -16,26 +16,26 @@ object Test {
fun withInnerGenericInlineClassIn(a: AsCmp<AsCmp<Comparable<UInt>>>) {}
}
// method: Test::withInlineClassArgumentOut
// method: Test::withInlineClassArgumentOut$5xv5g663
// jvm signature: (Ljava/util/List;)V
// generic signature: (Ljava/util/List<LUInt;>;)V
// method: Test::withInlineClassArgumentIn
// method: Test::withInlineClassArgumentIn$brqdr5wn
// jvm signature: (Ljava/lang/Comparable;)V
// generic signature: (Ljava/lang/Comparable<-LUInt;>;)V
// method: Test::withListOfInlineClassArgument
// method: Test::withListOfInlineClassArgument$5xv5g663
// jvm signature: (Ljava/util/List;)V
// generic signature: (Ljava/util/List<+Ljava/util/List<LUInt;>;>;)V
// method: Test::withComparableOfInlineClassArgument
// method: Test::withComparableOfInlineClassArgument$brqdr5wn
// jvm signature: (Ljava/lang/Comparable;)V
// generic signature: (Ljava/lang/Comparable<-Ljava/lang/Comparable<-LUInt;>;>;)V
// method: Test::withInnerGenericInlineClassOut
// method: Test::withInnerGenericInlineClassOut$5xv5g663
// jvm signature: (Ljava/util/List;)V
// generic signature: (Ljava/util/List<LAsList<Ljava/util/List<LUInt;>;>;>;)V
// method: Test::withInnerGenericInlineClassIn
// method: Test::withInnerGenericInlineClassIn$brqdr5wn
// jvm signature: (Ljava/lang/Comparable;)V
// generic signature: (Ljava/lang/Comparable<-LAsCmp<Ljava/lang/Comparable<LUInt;>;>;>;)V
@@ -13,18 +13,18 @@ object Test {
fun withNullableReferenceAsNullable(a: InlineNullableReference?) {}
}
// method: Test::withPrimitiveAsNullable
// method: Test::withPrimitiveAsNullable$arwt9fzf
// jvm signature: (LInlinePrimitive;)V
// generic signature: null
// method: Test::withReferenceAsNullable
// method: Test::withReferenceAsNullable$8k1ogbuu
// jvm signature: (Ljava/lang/String;)V
// generic signature: null
// method: Test::withNullablePrimitiveAsNullable
// method: Test::withNullablePrimitiveAsNullable$aiqm4cvc
// jvm signature: (LInlineNullablePrimitive;)V
// generic signature: null
// method: Test::withNullableReferenceAsNullable
// method: Test::withNullableReferenceAsNullable$7pmrpo2y
// jvm signature: (LInlineNullableReference;)V
// generic signature: null
@@ -9,7 +9,7 @@ object Test {
fun Foo.asAll(x: Any?, a: Foo, b: Int): Foo = TODO()
}
// method: Test::asParam
// method: Test::asParam$1e4ch6lh
// jvm signature: (I)V
// generic signature: null
@@ -17,10 +17,10 @@ object Test {
// jvm signature: ()I
// generic signature: null
// method: Test::asExtension
// method: Test::asExtension$1e4ch6lh
// jvm signature: (I)V
// generic signature: null
// method: Test::asAll
// method: Test::asAll$dmjdpekg
// jvm signature: (ILjava/lang/Object;II)I
// generic signature: null
@@ -10,7 +10,7 @@ object Test {
fun asReturn(): Bar = TODO()
}
// method: Test::asParam
// method: Test::asParam$1e4ch6lh
// jvm signature: (Ljava/lang/Integer;)V
// generic signature: null
@@ -10877,6 +10877,16 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
runTest("compiler/testData/diagnostics/tests/inlineClasses/delegatedPropertyInInlineClass.kt");
}
@TestMetadata("functionsJvmSignaturesClash.kt")
public void testFunctionsJvmSignaturesClash() throws Exception {
runTest("compiler/testData/diagnostics/tests/inlineClasses/functionsJvmSignaturesClash.kt");
}
@TestMetadata("functionsJvmSignaturesConflictOnInheritance.kt")
public void testFunctionsJvmSignaturesConflictOnInheritance() throws Exception {
runTest("compiler/testData/diagnostics/tests/inlineClasses/functionsJvmSignaturesConflictOnInheritance.kt");
}
@TestMetadata("identityComparisonWithInlineClasses.kt")
public void testIdentityComparisonWithInlineClasses() throws Exception {
runTest("compiler/testData/diagnostics/tests/inlineClasses/identityComparisonWithInlineClasses.kt");
@@ -10877,6 +10877,16 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
runTest("compiler/testData/diagnostics/tests/inlineClasses/delegatedPropertyInInlineClass.kt");
}
@TestMetadata("functionsJvmSignaturesClash.kt")
public void testFunctionsJvmSignaturesClash() throws Exception {
runTest("compiler/testData/diagnostics/tests/inlineClasses/functionsJvmSignaturesClash.kt");
}
@TestMetadata("functionsJvmSignaturesConflictOnInheritance.kt")
public void testFunctionsJvmSignaturesConflictOnInheritance() throws Exception {
runTest("compiler/testData/diagnostics/tests/inlineClasses/functionsJvmSignaturesConflictOnInheritance.kt");
}
@TestMetadata("identityComparisonWithInlineClasses.kt")
public void testIdentityComparisonWithInlineClasses() throws Exception {
runTest("compiler/testData/diagnostics/tests/inlineClasses/identityComparisonWithInlineClasses.kt");
@@ -11757,6 +11757,104 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
public void testUseThisInsideInlineClass() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/useThisInsideInlineClass.kt");
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses/functionNameMangling")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class FunctionNameMangling extends AbstractBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInFunctionNameMangling() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/functionNameMangling"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("anonymousObjectInFunctionWithMangledName.kt")
public void testAnonymousObjectInFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/anonymousObjectInFunctionWithMangledName.kt");
}
@TestMetadata("extensionFunctionsDoNotClash.kt")
public void testExtensionFunctionsDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/extensionFunctionsDoNotClash.kt");
}
@TestMetadata("functionsWithDifferentNullabilityDoNotClash.kt")
public void testFunctionsWithDifferentNullabilityDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/functionsWithDifferentNullabilityDoNotClash.kt");
}
@TestMetadata("genericFunctionsDoNotClash.kt")
public void testGenericFunctionsDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/genericFunctionsDoNotClash.kt");
}
@TestMetadata("localClassInFunctionWithMangledName.kt")
public void testLocalClassInFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/localClassInFunctionWithMangledName.kt");
}
@TestMetadata("mangledFunctionsCanBeOverridden.kt")
public void testMangledFunctionsCanBeOverridden() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/mangledFunctionsCanBeOverridden.kt");
}
@TestMetadata("mangledFunctionsDoNotClash.kt")
public void testMangledFunctionsDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/mangledFunctionsDoNotClash.kt");
}
@TestMetadata("mangledFunctionsPresentInStackTrace.kt")
public void testMangledFunctionsPresentInStackTrace() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/mangledFunctionsPresentInStackTrace.kt");
}
@TestMetadata("mixedSignatureFunctionsDoNotClash.kt")
public void testMixedSignatureFunctionsDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/mixedSignatureFunctionsDoNotClash.kt");
}
@TestMetadata("overridingMethodInGenericClass.kt")
public void testOverridingMethodInGenericClass() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/overridingMethodInGenericClass.kt");
}
@TestMetadata("overridingMethodInGenericClass2.kt")
public void testOverridingMethodInGenericClass2() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/overridingMethodInGenericClass2.kt");
}
@TestMetadata("propertySetterWithInlineClassTypeArgument.kt")
public void testPropertySetterWithInlineClassTypeArgument() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/propertySetterWithInlineClassTypeArgument.kt");
}
@TestMetadata("reflectionForFunctionWithMangledName.kt")
public void testReflectionForFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/reflectionForFunctionWithMangledName.kt");
}
@TestMetadata("reflectionForLocalClassInFunctionWithMangledName.kt")
public void testReflectionForLocalClassInFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/reflectionForLocalClassInFunctionWithMangledName.kt");
}
@TestMetadata("reflectionForPropertyOfInlineClassType.kt")
public void testReflectionForPropertyOfInlineClassType() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/reflectionForPropertyOfInlineClassType.kt");
}
@TestMetadata("syntheticAccessorForFunctionWithMangledName.kt")
public void testSyntheticAccessorForFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/syntheticAccessorForFunctionWithMangledName.kt");
}
@TestMetadata("syntheticAccessorsForPropertyOfInlineClassType.kt")
public void testSyntheticAccessorsForPropertyOfInlineClassType() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/syntheticAccessorsForPropertyOfInlineClassType.kt");
}
}
}
@TestMetadata("compiler/testData/codegen/box/innerNested")
@@ -2058,6 +2058,16 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/checkOuterInlineFunctionCall.kt");
}
@TestMetadata("constructorWithInlineClassParametersIsNotMangled.kt")
public void testConstructorWithInlineClassParametersIsNotMangled() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/constructorWithInlineClassParametersIsNotMangled.kt");
}
@TestMetadata("functionsWithInlineClassParametersHaveStableMangledNames.kt")
public void testFunctionsWithInlineClassParametersHaveStableMangledNames() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/functionsWithInlineClassParametersHaveStableMangledNames.kt");
}
@TestMetadata("generationOfAccessorToUnderlyingValue.kt")
public void testGenerationOfAccessorToUnderlyingValue() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/generationOfAccessorToUnderlyingValue.kt");
@@ -2113,6 +2123,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/passInlineClassesWithSpreadOperatorToVarargs.kt");
}
@TestMetadata("propertySetterWithInlineClassTypeArgument.kt")
public void testPropertySetterWithInlineClassTypeArgument() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/propertySetterWithInlineClassTypeArgument.kt");
}
@TestMetadata("skipCallToUnderlyingValueOfInlineClass.kt")
public void testSkipCallToUnderlyingValueOfInlineClass() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/skipCallToUnderlyingValueOfInlineClass.kt");
@@ -11757,6 +11757,104 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
public void testUseThisInsideInlineClass() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/useThisInsideInlineClass.kt");
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses/functionNameMangling")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class FunctionNameMangling extends AbstractLightAnalysisModeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInFunctionNameMangling() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/functionNameMangling"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("anonymousObjectInFunctionWithMangledName.kt")
public void testAnonymousObjectInFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/anonymousObjectInFunctionWithMangledName.kt");
}
@TestMetadata("extensionFunctionsDoNotClash.kt")
public void testExtensionFunctionsDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/extensionFunctionsDoNotClash.kt");
}
@TestMetadata("functionsWithDifferentNullabilityDoNotClash.kt")
public void testFunctionsWithDifferentNullabilityDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/functionsWithDifferentNullabilityDoNotClash.kt");
}
@TestMetadata("genericFunctionsDoNotClash.kt")
public void testGenericFunctionsDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/genericFunctionsDoNotClash.kt");
}
@TestMetadata("localClassInFunctionWithMangledName.kt")
public void testLocalClassInFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/localClassInFunctionWithMangledName.kt");
}
@TestMetadata("mangledFunctionsCanBeOverridden.kt")
public void testMangledFunctionsCanBeOverridden() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/mangledFunctionsCanBeOverridden.kt");
}
@TestMetadata("mangledFunctionsDoNotClash.kt")
public void testMangledFunctionsDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/mangledFunctionsDoNotClash.kt");
}
@TestMetadata("mangledFunctionsPresentInStackTrace.kt")
public void testMangledFunctionsPresentInStackTrace() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/mangledFunctionsPresentInStackTrace.kt");
}
@TestMetadata("mixedSignatureFunctionsDoNotClash.kt")
public void testMixedSignatureFunctionsDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/mixedSignatureFunctionsDoNotClash.kt");
}
@TestMetadata("overridingMethodInGenericClass.kt")
public void testOverridingMethodInGenericClass() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/overridingMethodInGenericClass.kt");
}
@TestMetadata("overridingMethodInGenericClass2.kt")
public void testOverridingMethodInGenericClass2() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/overridingMethodInGenericClass2.kt");
}
@TestMetadata("propertySetterWithInlineClassTypeArgument.kt")
public void testPropertySetterWithInlineClassTypeArgument() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/propertySetterWithInlineClassTypeArgument.kt");
}
@TestMetadata("reflectionForFunctionWithMangledName.kt")
public void testReflectionForFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/reflectionForFunctionWithMangledName.kt");
}
@TestMetadata("reflectionForLocalClassInFunctionWithMangledName.kt")
public void testReflectionForLocalClassInFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/reflectionForLocalClassInFunctionWithMangledName.kt");
}
@TestMetadata("reflectionForPropertyOfInlineClassType.kt")
public void testReflectionForPropertyOfInlineClassType() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/reflectionForPropertyOfInlineClassType.kt");
}
@TestMetadata("syntheticAccessorForFunctionWithMangledName.kt")
public void testSyntheticAccessorForFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/syntheticAccessorForFunctionWithMangledName.kt");
}
@TestMetadata("syntheticAccessorsForPropertyOfInlineClassType.kt")
public void testSyntheticAccessorsForPropertyOfInlineClassType() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/syntheticAccessorsForPropertyOfInlineClassType.kt");
}
}
}
@TestMetadata("compiler/testData/codegen/box/innerNested")
@@ -11757,6 +11757,104 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
public void testUseThisInsideInlineClass() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/useThisInsideInlineClass.kt");
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses/functionNameMangling")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class FunctionNameMangling extends AbstractIrBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
}
public void testAllFilesPresentInFunctionNameMangling() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/functionNameMangling"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
}
@TestMetadata("anonymousObjectInFunctionWithMangledName.kt")
public void testAnonymousObjectInFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/anonymousObjectInFunctionWithMangledName.kt");
}
@TestMetadata("extensionFunctionsDoNotClash.kt")
public void testExtensionFunctionsDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/extensionFunctionsDoNotClash.kt");
}
@TestMetadata("functionsWithDifferentNullabilityDoNotClash.kt")
public void testFunctionsWithDifferentNullabilityDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/functionsWithDifferentNullabilityDoNotClash.kt");
}
@TestMetadata("genericFunctionsDoNotClash.kt")
public void testGenericFunctionsDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/genericFunctionsDoNotClash.kt");
}
@TestMetadata("localClassInFunctionWithMangledName.kt")
public void testLocalClassInFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/localClassInFunctionWithMangledName.kt");
}
@TestMetadata("mangledFunctionsCanBeOverridden.kt")
public void testMangledFunctionsCanBeOverridden() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/mangledFunctionsCanBeOverridden.kt");
}
@TestMetadata("mangledFunctionsDoNotClash.kt")
public void testMangledFunctionsDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/mangledFunctionsDoNotClash.kt");
}
@TestMetadata("mangledFunctionsPresentInStackTrace.kt")
public void testMangledFunctionsPresentInStackTrace() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/mangledFunctionsPresentInStackTrace.kt");
}
@TestMetadata("mixedSignatureFunctionsDoNotClash.kt")
public void testMixedSignatureFunctionsDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/mixedSignatureFunctionsDoNotClash.kt");
}
@TestMetadata("overridingMethodInGenericClass.kt")
public void testOverridingMethodInGenericClass() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/overridingMethodInGenericClass.kt");
}
@TestMetadata("overridingMethodInGenericClass2.kt")
public void testOverridingMethodInGenericClass2() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/overridingMethodInGenericClass2.kt");
}
@TestMetadata("propertySetterWithInlineClassTypeArgument.kt")
public void testPropertySetterWithInlineClassTypeArgument() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/propertySetterWithInlineClassTypeArgument.kt");
}
@TestMetadata("reflectionForFunctionWithMangledName.kt")
public void testReflectionForFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/reflectionForFunctionWithMangledName.kt");
}
@TestMetadata("reflectionForLocalClassInFunctionWithMangledName.kt")
public void testReflectionForLocalClassInFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/reflectionForLocalClassInFunctionWithMangledName.kt");
}
@TestMetadata("reflectionForPropertyOfInlineClassType.kt")
public void testReflectionForPropertyOfInlineClassType() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/reflectionForPropertyOfInlineClassType.kt");
}
@TestMetadata("syntheticAccessorForFunctionWithMangledName.kt")
public void testSyntheticAccessorForFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/syntheticAccessorForFunctionWithMangledName.kt");
}
@TestMetadata("syntheticAccessorsForPropertyOfInlineClassType.kt")
public void testSyntheticAccessorsForPropertyOfInlineClassType() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/syntheticAccessorsForPropertyOfInlineClassType.kt");
}
}
}
@TestMetadata("compiler/testData/codegen/box/innerNested")
@@ -286,7 +286,7 @@ fun computeInternalName(
private fun getContainer(container: DeclarationDescriptor?): DeclarationDescriptor? =
container as? ClassDescriptor ?: container as? PackageFragmentDescriptor ?: container?.let { getContainer(it.containingDeclaration) }
private fun getRepresentativeUpperBound(descriptor: TypeParameterDescriptor): KotlinType {
fun getRepresentativeUpperBound(descriptor: TypeParameterDescriptor): KotlinType {
val upperBounds = descriptor.upperBounds
assert(!upperBounds.isEmpty()) { "Upper bounds should not be empty: $descriptor" }
@@ -10307,6 +10307,104 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
public void testUseThisInsideInlineClass() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/useThisInsideInlineClass.kt");
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses/functionNameMangling")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class FunctionNameMangling extends AbstractIrJsCodegenBoxTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInFunctionNameMangling() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/functionNameMangling"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("anonymousObjectInFunctionWithMangledName.kt")
public void testAnonymousObjectInFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/anonymousObjectInFunctionWithMangledName.kt");
}
@TestMetadata("extensionFunctionsDoNotClash.kt")
public void testExtensionFunctionsDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/extensionFunctionsDoNotClash.kt");
}
@TestMetadata("functionsWithDifferentNullabilityDoNotClash.kt")
public void testFunctionsWithDifferentNullabilityDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/functionsWithDifferentNullabilityDoNotClash.kt");
}
@TestMetadata("genericFunctionsDoNotClash.kt")
public void testGenericFunctionsDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/genericFunctionsDoNotClash.kt");
}
@TestMetadata("localClassInFunctionWithMangledName.kt")
public void testLocalClassInFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/localClassInFunctionWithMangledName.kt");
}
@TestMetadata("mangledFunctionsCanBeOverridden.kt")
public void testMangledFunctionsCanBeOverridden() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/mangledFunctionsCanBeOverridden.kt");
}
@TestMetadata("mangledFunctionsDoNotClash.kt")
public void testMangledFunctionsDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/mangledFunctionsDoNotClash.kt");
}
@TestMetadata("mangledFunctionsPresentInStackTrace.kt")
public void testMangledFunctionsPresentInStackTrace() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/mangledFunctionsPresentInStackTrace.kt");
}
@TestMetadata("mixedSignatureFunctionsDoNotClash.kt")
public void testMixedSignatureFunctionsDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/mixedSignatureFunctionsDoNotClash.kt");
}
@TestMetadata("overridingMethodInGenericClass.kt")
public void testOverridingMethodInGenericClass() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/overridingMethodInGenericClass.kt");
}
@TestMetadata("overridingMethodInGenericClass2.kt")
public void testOverridingMethodInGenericClass2() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/overridingMethodInGenericClass2.kt");
}
@TestMetadata("propertySetterWithInlineClassTypeArgument.kt")
public void testPropertySetterWithInlineClassTypeArgument() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/propertySetterWithInlineClassTypeArgument.kt");
}
@TestMetadata("reflectionForFunctionWithMangledName.kt")
public void testReflectionForFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/reflectionForFunctionWithMangledName.kt");
}
@TestMetadata("reflectionForLocalClassInFunctionWithMangledName.kt")
public void testReflectionForLocalClassInFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/reflectionForLocalClassInFunctionWithMangledName.kt");
}
@TestMetadata("reflectionForPropertyOfInlineClassType.kt")
public void testReflectionForPropertyOfInlineClassType() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/reflectionForPropertyOfInlineClassType.kt");
}
@TestMetadata("syntheticAccessorForFunctionWithMangledName.kt")
public void testSyntheticAccessorForFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/syntheticAccessorForFunctionWithMangledName.kt");
}
@TestMetadata("syntheticAccessorsForPropertyOfInlineClassType.kt")
public void testSyntheticAccessorsForPropertyOfInlineClassType() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/syntheticAccessorsForPropertyOfInlineClassType.kt");
}
}
}
@TestMetadata("compiler/testData/codegen/box/innerNested")
@@ -11367,6 +11367,104 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
public void testUseThisInsideInlineClass() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/useThisInsideInlineClass.kt");
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses/functionNameMangling")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class FunctionNameMangling extends AbstractJsCodegenBoxTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
}
public void testAllFilesPresentInFunctionNameMangling() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/functionNameMangling"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
}
@TestMetadata("anonymousObjectInFunctionWithMangledName.kt")
public void testAnonymousObjectInFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/anonymousObjectInFunctionWithMangledName.kt");
}
@TestMetadata("extensionFunctionsDoNotClash.kt")
public void testExtensionFunctionsDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/extensionFunctionsDoNotClash.kt");
}
@TestMetadata("functionsWithDifferentNullabilityDoNotClash.kt")
public void testFunctionsWithDifferentNullabilityDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/functionsWithDifferentNullabilityDoNotClash.kt");
}
@TestMetadata("genericFunctionsDoNotClash.kt")
public void testGenericFunctionsDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/genericFunctionsDoNotClash.kt");
}
@TestMetadata("localClassInFunctionWithMangledName.kt")
public void testLocalClassInFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/localClassInFunctionWithMangledName.kt");
}
@TestMetadata("mangledFunctionsCanBeOverridden.kt")
public void testMangledFunctionsCanBeOverridden() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/mangledFunctionsCanBeOverridden.kt");
}
@TestMetadata("mangledFunctionsDoNotClash.kt")
public void testMangledFunctionsDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/mangledFunctionsDoNotClash.kt");
}
@TestMetadata("mangledFunctionsPresentInStackTrace.kt")
public void testMangledFunctionsPresentInStackTrace() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/mangledFunctionsPresentInStackTrace.kt");
}
@TestMetadata("mixedSignatureFunctionsDoNotClash.kt")
public void testMixedSignatureFunctionsDoNotClash() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/mixedSignatureFunctionsDoNotClash.kt");
}
@TestMetadata("overridingMethodInGenericClass.kt")
public void testOverridingMethodInGenericClass() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/overridingMethodInGenericClass.kt");
}
@TestMetadata("overridingMethodInGenericClass2.kt")
public void testOverridingMethodInGenericClass2() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/overridingMethodInGenericClass2.kt");
}
@TestMetadata("propertySetterWithInlineClassTypeArgument.kt")
public void testPropertySetterWithInlineClassTypeArgument() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/propertySetterWithInlineClassTypeArgument.kt");
}
@TestMetadata("reflectionForFunctionWithMangledName.kt")
public void testReflectionForFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/reflectionForFunctionWithMangledName.kt");
}
@TestMetadata("reflectionForLocalClassInFunctionWithMangledName.kt")
public void testReflectionForLocalClassInFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/reflectionForLocalClassInFunctionWithMangledName.kt");
}
@TestMetadata("reflectionForPropertyOfInlineClassType.kt")
public void testReflectionForPropertyOfInlineClassType() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/reflectionForPropertyOfInlineClassType.kt");
}
@TestMetadata("syntheticAccessorForFunctionWithMangledName.kt")
public void testSyntheticAccessorForFunctionWithMangledName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/syntheticAccessorForFunctionWithMangledName.kt");
}
@TestMetadata("syntheticAccessorsForPropertyOfInlineClassType.kt")
public void testSyntheticAccessorsForPropertyOfInlineClassType() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/functionNameMangling/syntheticAccessorsForPropertyOfInlineClassType.kt");
}
}
}
@TestMetadata("compiler/testData/codegen/box/innerNested")