[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,140 @@
// CHECK:
// Mangled name: DefaultImpl
// Public signature: /DefaultImpl|null[0]
class DefaultImpl : IFoo {
// CHECK:
// Mangled name: DefaultImpl#<init>(){}
// Public signature: /DefaultImpl.<init>|-5645683436151566731[0]
constructor() /* primary */
// CHECK:
// Mangled name: DefaultImpl@kotlin.String{}extProp
// Public signature: /DefaultImpl.extProp|9137761441129982647[0]
/* fake */ override val String.extProp: String
// CHECK JVM_IR:
// Mangled name: DefaultImpl#<get-extProp>@kotlin.String(){}kotlin.String
// Public signature: /DefaultImpl.extProp.<get-extProp>|-8732758648969586151[0]
// CHECK JS_IR NATIVE:
// Mangled name: DefaultImpl#<get-extProp>@kotlin.String(){}
// Public signature: /DefaultImpl.extProp.<get-extProp>|-2957953481772901234[0]
/* fake */ override get(): String
// CHECK:
// Mangled name: DefaultImpl{}prop
// Public signature: /DefaultImpl.prop|3598315380056892812[0]
/* fake */ override val prop: String
// CHECK JVM_IR:
// Mangled name: DefaultImpl#<get-prop>(){}kotlin.String
// Public signature: /DefaultImpl.prop.<get-prop>|-4077144726618700772[0]
// CHECK JS_IR NATIVE:
// Mangled name: DefaultImpl#<get-prop>(){}
// Public signature: /DefaultImpl.prop.<get-prop>|-5734736374948136327[0]
/* fake */ override get(): String
}
// CHECK:
// Mangled name: Delegated
// Public signature: /Delegated|null[0]
class Delegated : IFoo {
// CHECK:
// Mangled name: Delegated#<init>(IFoo){}
// Public signature: /Delegated.<init>|-657369904845510135[0]
constructor(foo: IFoo) /* primary */
// CHECK:
// Mangled name: Delegated.$$delegate_0
// Public signature: /Delegated.$$delegate_0|-7286425919675154353[0]
private /* final field */ val $$delegate_0: IFoo
// CHECK:
// Mangled name: Delegated@kotlin.String{}extProp
// Public signature: /Delegated.extProp|9137761441129982647[0]
override val String.extProp: String
// CHECK JVM_IR:
// Mangled name: Delegated#<get-extProp>@kotlin.String(){}kotlin.String
// Public signature: /Delegated.extProp.<get-extProp>|-8732758648969586151[0]
// CHECK JS_IR NATIVE:
// Mangled name: Delegated#<get-extProp>@kotlin.String(){}
// Public signature: /Delegated.extProp.<get-extProp>|-2957953481772901234[0]
override get(): String
// CHECK:
// Mangled name: Delegated{}prop
// Public signature: /Delegated.prop|3598315380056892812[0]
override val prop: String
// CHECK JVM_IR:
// Mangled name: Delegated#<get-prop>(){}kotlin.String
// Public signature: /Delegated.prop.<get-prop>|-4077144726618700772[0]
// CHECK JS_IR NATIVE:
// Mangled name: Delegated#<get-prop>(){}
// Public signature: /Delegated.prop.<get-prop>|-5734736374948136327[0]
override get(): String
}
// CHECK:
// Mangled name: ExplicitOverride
// Public signature: /ExplicitOverride|null[0]
class ExplicitOverride : IFoo {
// CHECK:
// Mangled name: ExplicitOverride#<init>(){}
// Public signature: /ExplicitOverride.<init>|-5645683436151566731[0]
constructor() /* primary */
// CHECK:
// Mangled name: ExplicitOverride@kotlin.String{}extProp
// Public signature: /ExplicitOverride.extProp|9137761441129982647[0]
override val String.extProp: String
// CHECK JVM_IR:
// Mangled name: ExplicitOverride#<get-extProp>@kotlin.String(){}kotlin.String
// Public signature: /ExplicitOverride.extProp.<get-extProp>|-8732758648969586151[0]
// CHECK JS_IR NATIVE:
// Mangled name: ExplicitOverride#<get-extProp>@kotlin.String(){}
// Public signature: /ExplicitOverride.extProp.<get-extProp>|-2957953481772901234[0]
override get(): String
// CHECK:
// Mangled name: ExplicitOverride{}prop
// Public signature: /ExplicitOverride.prop|3598315380056892812[0]
override val prop: String
// CHECK JVM_IR:
// Mangled name: ExplicitOverride#<get-prop>(){}kotlin.String
// Public signature: /ExplicitOverride.prop.<get-prop>|-4077144726618700772[0]
// CHECK JS_IR NATIVE:
// Mangled name: ExplicitOverride#<get-prop>(){}
// Public signature: /ExplicitOverride.prop.<get-prop>|-5734736374948136327[0]
override get(): String
}
// CHECK:
// Mangled name: IFoo
// Public signature: /IFoo|null[0]
interface IFoo {
// CHECK:
// Mangled name: IFoo@kotlin.String{}extProp
// Public signature: /IFoo.extProp|9137761441129982647[0]
val String.extProp: String
// CHECK JVM_IR:
// Mangled name: IFoo#<get-extProp>@kotlin.String(){}kotlin.String
// Public signature: /IFoo.extProp.<get-extProp>|-8732758648969586151[0]
// CHECK JS_IR NATIVE:
// Mangled name: IFoo#<get-extProp>@kotlin.String(){}
// Public signature: /IFoo.extProp.<get-extProp>|-2957953481772901234[0]
get(): String
// CHECK:
// Mangled name: IFoo{}prop
// Public signature: /IFoo.prop|3598315380056892812[0]
val prop: String
// CHECK JVM_IR:
// Mangled name: IFoo#<get-prop>(){}kotlin.String
// Public signature: /IFoo.prop.<get-prop>|-4077144726618700772[0]
// CHECK JS_IR NATIVE:
// Mangled name: IFoo#<get-prop>(){}
// Public signature: /IFoo.prop.<get-prop>|-5734736374948136327[0]
get(): String
}