[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:
committed by
Space Team
parent
bccf69910d
commit
6e8283a6fe
+93
@@ -0,0 +1,93 @@
|
||||
// CHECK:
|
||||
// Mangled name: Monoid
|
||||
// Public signature: /Monoid|null[0]
|
||||
interface Monoid<T : Any?> : Semigroup<T> {
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: Monoid#combine@1:0(1:0){}1:0
|
||||
// Public signature: /Monoid.combine|-3517256775590682507[0]
|
||||
abstract /* fake */ override infix fun T.combine(other: T): T
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: Monoid{}unit
|
||||
// Public signature: /Monoid.unit|-5200734743185576787[0]
|
||||
abstract val unit: T
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: Monoid#<get-unit>(){}1:0
|
||||
// Public signature: /Monoid.unit.<get-unit>|-2842189358620964971[0]
|
||||
abstract get
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: Semigroup
|
||||
// Public signature: /Semigroup|null[0]
|
||||
interface Semigroup<T : Any?> {
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: Semigroup#combine@1:0(1:0){}1:0
|
||||
// Public signature: /Semigroup.combine|-3517256775590682507[0]
|
||||
abstract infix fun T.combine(other: T): T
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: IntMonoid
|
||||
// Public signature: /IntMonoid|null[0]
|
||||
object IntMonoid : Monoid<Int> {
|
||||
// CHECK:
|
||||
// Mangled name: IntMonoid{}unit
|
||||
// Public signature: /IntMonoid.unit|-5200734743185576787[0]
|
||||
override val unit: Int
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: IntMonoid#<get-unit>(){}kotlin.Int
|
||||
// Public signature: /IntMonoid.unit.<get-unit>|3772729924213749256[0]
|
||||
override get
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: IntMonoid#<init>(){}
|
||||
// Public signature: /IntMonoid.<init>|-5645683436151566731[0]
|
||||
private constructor() /* primary */
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: IntMonoid#combine@kotlin.Int(kotlin.Int){}kotlin.Int
|
||||
// Public signature: /IntMonoid.combine|4765448259581317405[0]
|
||||
override infix fun Int.combine(other: Int): Int
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: StringMonoid
|
||||
// Public signature: /StringMonoid|null[0]
|
||||
object StringMonoid : Monoid<String> {
|
||||
// CHECK:
|
||||
// Mangled name: StringMonoid{}unit
|
||||
// Public signature: /StringMonoid.unit|-5200734743185576787[0]
|
||||
override val unit: String
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: StringMonoid#<get-unit>(){}kotlin.String
|
||||
// Public signature: /StringMonoid.unit.<get-unit>|4504480110251605077[0]
|
||||
override get
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: StringMonoid#<init>(){}
|
||||
// Public signature: /StringMonoid.<init>|-5645683436151566731[0]
|
||||
private constructor() /* primary */
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: StringMonoid#combine@kotlin.String(kotlin.String){}kotlin.String
|
||||
// Public signature: /StringMonoid.combine|-5815259829474546918[0]
|
||||
override infix fun String.combine(other: String): String
|
||||
|
||||
}
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #box(){}kotlin.String
|
||||
// Public signature: /box|-9347091776561469[0]
|
||||
fun box(): String
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name computed from Ir: #sum@kotlin.collections.List<0:0>(Monoid<0:0>){0§<kotlin.Any?>}0:0
|
||||
// Mangled name computed from Descriptor: #sum!Monoid<0:0>@kotlin.collections.List<0:0>(){0§<kotlin.Any?>}0:0
|
||||
// Public signature: /sum|7635142307973834922[0]
|
||||
fun <T : Any?> List<T>.sum($context_receiver_0: Monoid<T>): T
|
||||
|
||||
Reference in New Issue
Block a user