[IR] Dump IdSignatures and mangled names in irText tests

The reason #1 for this feature is that we want to test IdSignatures
generated for declarations. Currently, there is no (easy) way to ensure
that a change in the signature building logic doesn't cause any breaking
changes wrt klibs.

Now, most IdSignatures include hashed mangled names in them, so even if
we catch a regression where the included hash changes, there would be no
way of knowing immediately what caused it, unless we'd also have mangled
names in the expectations.

The reason #2 is to test the manglers themselves. Currently, there are
no tests for them. They heavily duplicate each other, this is already
causing issues (see KT-57427) that would be very hard to catch without
these tests.

^KT-58238 Fixed
This commit is contained in:
Sergej Jaskiewicz
2023-04-06 15:07:36 +02:00
committed by Space Team
parent bccf69910d
commit 6e8283a6fe
791 changed files with 36162 additions and 357 deletions
@@ -0,0 +1,71 @@
// CHECK:
// Mangled name: A
// Public signature: /A|null[0]
class A {
// CHECK:
// Mangled name: A{}a
// Public signature: /A.a|-1200697420457237799[0]
val a: Any?
// CHECK JVM_IR:
// Mangled name: A#<get-a>(){}kotlin.Any?
// Public signature: /A.a.<get-a>|-5253003527138676623[0]
get
// CHECK:
// Mangled name: A#<init>(kotlin.Any?){}
// Public signature: /A.<init>|-8205545948568413246[0]
constructor(a: Any?) /* primary */
}
// CHECK:
// Mangled name: Context
// Public signature: /Context|null[0]
class Context {
// CHECK:
// Mangled name: Context#<init>(){}
// Public signature: /Context.<init>|-5645683436151566731[0]
constructor() /* primary */
// CHECK JVM_IR:
// Mangled name: Context#c(){}kotlin.Int
// Public signature: /Context.c|-7090409735962961857[0]
fun c(): Int
}
// CHECK JVM_IR:
// Mangled name: #box(){}kotlin.String
// Public signature: /box|-9347091776561469[0]
fun box(): String
// CHECK JVM_IR:
// Mangled name computed from Ir: #testInline(Context){}kotlin.Int
// Mangled name computed from Descriptor: #testInline!Context(){}kotlin.Int
// Public signature: /testInline|2700554304824268037[0]
inline fun testInline($context_receiver_0: Context): Int
// CHECK JVM_IR:
// Mangled name computed from Ir: #testInlineWithArg(Context;kotlin.Int){}kotlin.Int
// Mangled name computed from Descriptor: #testInlineWithArg!Context(kotlin.Int){}kotlin.Int
// Public signature: /testInlineWithArg|9204994988875814257[0]
inline fun testInlineWithArg($context_receiver_0: Context, i: Int): Int
// CHECK JVM_IR:
// Mangled name computed from Ir: #testInlineWithExtensionAndArg@kotlin.Int(Context;kotlin.Int){}kotlin.Int
// Mangled name computed from Descriptor: #testInlineWithExtensionAndArg!Context@kotlin.Int(kotlin.Int){}kotlin.Int
// Public signature: /testInlineWithExtensionAndArg|-7753885706218316674[0]
inline fun Int.testInlineWithExtensionAndArg($context_receiver_0: Context, i: Int): Int
// CHECK JVM_IR:
// Mangled name computed from Ir: #testInlineWithExtensionAndMultipleArgs@kotlin.Int(Context;kotlin.Int;kotlin.Int){}kotlin.Int
// Mangled name computed from Descriptor: #testInlineWithExtensionAndMultipleArgs!Context@kotlin.Int(kotlin.Int;kotlin.Int){}kotlin.Int
// Public signature: /testInlineWithExtensionAndMultipleArgs|6839067967550411636[0]
inline fun Int.testInlineWithExtensionAndMultipleArgs($context_receiver_0: Context, i1: Int, i2: Int): Int
// CHECK JVM_IR:
// Mangled name computed from Ir: #testInlineWithExtensionAndMultipleContextsAndArgs@kotlin.Int(Context;A;kotlin.Int;kotlin.Int){}kotlin.Int
// Mangled name computed from Descriptor: #testInlineWithExtensionAndMultipleContextsAndArgs!Context!A@kotlin.Int(kotlin.Int;kotlin.Int){}kotlin.Int
// Public signature: /testInlineWithExtensionAndMultipleContextsAndArgs|4315160499148454711[0]
inline fun Int.testInlineWithExtensionAndMultipleContextsAndArgs($context_receiver_0: Context, $context_receiver_1: A, i1: Int, i2: Int): Int