[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,43 @@
// CHECK:
// Mangled name: Flaf
// Public signature: /Flaf|null[0]
class Flaf {
// CHECK:
// Mangled name: Flaf{}javaName
// Public signature: /Flaf.javaName|-8684515170534215532[0]
val javaName: String
// CHECK JVM_IR:
// Mangled name: Flaf#<get-javaName>(){}kotlin.String
// Public signature: /Flaf.javaName.<get-javaName>|-917464454700477406[0]
// CHECK JS_IR NATIVE:
// Mangled name: Flaf#<get-javaName>(){}
// Public signature: /Flaf.javaName.<get-javaName>|1070493169031219158[0]
get
// CHECK:
// Mangled name: Flaf{}INSTANCES
// Public signature: /Flaf.INSTANCES|1897835723956041094[0]
private val INSTANCES: MutableMap<String, Flaf>
// CHECK JVM_IR:
// Mangled name: Flaf#<get-INSTANCES>(){}kotlin.collections.MutableMap<kotlin.String,Flaf>
// Public signature: /Flaf.INSTANCES.<get-INSTANCES>|-852664816279800923[0]
// CHECK JS_IR NATIVE:
// Mangled name: Flaf#<get-INSTANCES>(){}
// Public signature: /Flaf.INSTANCES.<get-INSTANCES>|7621104418939940009[0]
private get
// CHECK:
// Mangled name: Flaf#<init>(kotlin.String){}
// Public signature: /Flaf.<init>|1280618353163213788[0]
constructor(javaName: String) /* primary */
// CHECK JVM_IR:
// Mangled name: Flaf#forJavaName(kotlin.String){}Flaf
// Public signature: /Flaf.forJavaName|5746555906334011497[0]
// CHECK JS_IR NATIVE:
// Mangled name: Flaf#forJavaName(kotlin.String){}
// Public signature: /Flaf.forJavaName|-6191380422625646968[0]
fun forJavaName(javaName: String): Flaf
}