[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,50 @@
// CHECK JVM_IR:
// Mangled name: #test1(){}J<kotlin.String>
// Public signature: /test1|8889900013954121507[0]
fun test1(): J<String>
// CHECK:
// Mangled name: #test10(kotlin.Function1<kotlin.Int,kotlin.String>){}
// Public signature: /test10|3769162614537259024[0]
fun test10(fn: Function1<Int, String>): Unit
// CHECK JVM_IR:
// Mangled name: #test2(){}J<kotlin.String?>
// Public signature: /test2|-2485267088492515783[0]
fun test2(): J<String?>
// CHECK:
// Mangled name: #test3(){}
// Public signature: /test3|-3759735065270951803[0]
fun test3(): Unit
// CHECK:
// Mangled name: #test4(kotlin.Any){}
// Public signature: /test4|-9023258848991787985[0]
fun test4(a: Any): Unit
// CHECK:
// Mangled name: #test5(kotlin.Any){}
// Public signature: /test5|4504681808078971124[0]
fun test5(a: Any): Unit
// CHECK:
// Mangled name: #test6(kotlin.Function1<0:0,0:0>){0§<kotlin.Any?>}
// Public signature: /test6|-3081320997310711341[0]
fun <T : Any?> test6(a: Function1<T, T>): Unit
// CHECK:
// Mangled name: #test7(kotlin.Any){0§<kotlin.Any?>}
// Public signature: /test7|-5359981114052378429[0]
fun <T : Any?> test7(a: Any): Unit
// CHECK JVM_IR:
// Mangled name: #test8(kotlin.Function1<kotlin.String,kotlin.String>){}J<kotlin.String?>
// Public signature: /test8|-6112132748185879177[0]
fun test8(efn: @ExtensionFunctionType Function1<String, String>): J<String?>
// CHECK:
// Mangled name: #test9(kotlin.Function1<kotlin.String,kotlin.String>){}
// Public signature: /test9|5682079641444556672[0]
fun test9(efn: @ExtensionFunctionType Function1<String, String>): Unit