[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,171 @@
// CHECK:
// Mangled name: K1
// Public signature: /K1|null[0]
class K1 : JFoo {
// CHECK:
// Mangled name: K1#<init>(){}
// Public signature: /K1.<init>|-5645683436151566731[0]
constructor() /* primary */
// CHECK JVM_IR:
// Mangled name: K1#foo(){}kotlin.String{EnhancedNullability}
// Public signature: /K1.foo|7566064415059097436[0]
/* fake */ override fun foo(): @EnhancedNullability String
}
// CHECK:
// Mangled name: K2
// Public signature: /K2|null[0]
class K2 : JFoo {
// CHECK:
// Mangled name: K2#<init>(){}
// Public signature: /K2.<init>|-5645683436151566731[0]
constructor() /* primary */
// CHECK JVM_IR:
// Mangled name: K2#foo(){}kotlin.String
// Public signature: /K2.foo|485335955883620819[0]
override fun foo(): String
}
// CHECK:
// Mangled name: K3
// Public signature: /K3|null[0]
class K3 : JUnrelatedFoo, IFoo {
// CHECK:
// Mangled name: K3#<init>(){}
// Public signature: /K3.<init>|-5645683436151566731[0]
constructor() /* primary */
// CHECK JVM_IR:
// Mangled name: K3#foo(){}kotlin.String
// Public signature: /K3.foo|485335955883620819[0]
/* fake */ override fun foo(): String
}
// CHECK:
// Mangled name: K4
// Public signature: /K4|null[0]
class K4 : JUnrelatedFoo, IFoo {
// CHECK:
// Mangled name: K4#<init>(){}
// Public signature: /K4.<init>|-5645683436151566731[0]
constructor() /* primary */
// CHECK JVM_IR:
// Mangled name: K4#foo(){}kotlin.String?
// Public signature: /K4.foo|4483044608789364619[0]
override fun foo(): String?
}
// CHECK:
// Mangled name: TestJFoo
// Public signature: /TestJFoo|null[0]
class TestJFoo : IFoo {
// CHECK:
// Mangled name: TestJFoo#<init>(){}
// Public signature: /TestJFoo.<init>|-5645683436151566731[0]
constructor() /* primary */
// CHECK:
// Mangled name: TestJFoo.$$delegate_0
// Public signature: /TestJFoo.$$delegate_0|-7286425919675154353[0]
private /* final field */ val $$delegate_0: JFoo
// CHECK JVM_IR:
// Mangled name: TestJFoo#foo(){}kotlin.String
// Public signature: /TestJFoo.foo|485335955883620819[0]
override fun foo(): String
}
// CHECK:
// Mangled name: TestK1
// Public signature: /TestK1|null[0]
class TestK1 : IFoo {
// CHECK:
// Mangled name: TestK1#<init>(){}
// Public signature: /TestK1.<init>|-5645683436151566731[0]
constructor() /* primary */
// CHECK:
// Mangled name: TestK1.$$delegate_0
// Public signature: /TestK1.$$delegate_0|-7286425919675154353[0]
private /* final field */ val $$delegate_0: K1
// CHECK JVM_IR:
// Mangled name: TestK1#foo(){}kotlin.String
// Public signature: /TestK1.foo|485335955883620819[0]
override fun foo(): String
}
// CHECK:
// Mangled name: TestK2
// Public signature: /TestK2|null[0]
class TestK2 : IFoo {
// CHECK:
// Mangled name: TestK2#<init>(){}
// Public signature: /TestK2.<init>|-5645683436151566731[0]
constructor() /* primary */
// CHECK:
// Mangled name: TestK2.$$delegate_0
// Public signature: /TestK2.$$delegate_0|-7286425919675154353[0]
private /* final field */ val $$delegate_0: K2
// CHECK JVM_IR:
// Mangled name: TestK2#foo(){}kotlin.String
// Public signature: /TestK2.foo|485335955883620819[0]
override fun foo(): String
}
// CHECK:
// Mangled name: TestK3
// Public signature: /TestK3|null[0]
class TestK3 : IFoo {
// CHECK:
// Mangled name: TestK3#<init>(){}
// Public signature: /TestK3.<init>|-5645683436151566731[0]
constructor() /* primary */
// CHECK:
// Mangled name: TestK3.$$delegate_0
// Public signature: /TestK3.$$delegate_0|-7286425919675154353[0]
private /* final field */ val $$delegate_0: K3
// CHECK JVM_IR:
// Mangled name: TestK3#foo(){}kotlin.String
// Public signature: /TestK3.foo|485335955883620819[0]
override fun foo(): String
}
// CHECK:
// Mangled name: TestK4
// Public signature: /TestK4|null[0]
class TestK4 : IFoo {
// CHECK:
// Mangled name: TestK4#<init>(){}
// Public signature: /TestK4.<init>|-5645683436151566731[0]
constructor() /* primary */
// CHECK:
// Mangled name: TestK4.$$delegate_0
// Public signature: /TestK4.$$delegate_0|-7286425919675154353[0]
private /* final field */ val $$delegate_0: K4
// CHECK JVM_IR:
// Mangled name: TestK4#foo(){}kotlin.String
// Public signature: /TestK4.foo|485335955883620819[0]
override fun foo(): String
}
// CHECK:
// Mangled name: IFoo
// Public signature: /IFoo|null[0]
interface IFoo {
// CHECK JVM_IR:
// Mangled name: IFoo#foo(){}kotlin.String
// Public signature: /IFoo.foo|485335955883620819[0]
abstract fun foo(): String
}