[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
@@ -0,0 +1,8 @@
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #box(){}kotlin.String
|
||||
// Public signature: /box|-9347091776561469[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #box(){}
|
||||
// Public signature: /box|2173511048851971368[0]
|
||||
fun box(): String
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
|
||||
// MUTE_SIGNATURE_COMPARISON_K2: ANY
|
||||
// ^ KT-57436
|
||||
|
||||
interface CPointed
|
||||
|
||||
inline fun <reified T : CPointed> CPointed.reinterpret(): T = TODO()
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
// CHECK:
|
||||
// Mangled name: CInt32VarX
|
||||
// Public signature: /CInt32VarX|null[0]
|
||||
class CInt32VarX<T : Any?> : CPointed {
|
||||
// CHECK:
|
||||
// Mangled name: CInt32VarX#<init>(){}
|
||||
// Public signature: /CInt32VarX.<init>|-5645683436151566731[0]
|
||||
constructor() /* primary */
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: IdType
|
||||
// Public signature: /IdType|null[0]
|
||||
class IdType : CPointed {
|
||||
// CHECK:
|
||||
// Mangled name: IdType{}value
|
||||
// Public signature: /IdType.value|1987073854177347439[0]
|
||||
val value: Int
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: IdType#<get-value>(){}kotlin.Int
|
||||
// Public signature: /IdType.value.<get-value>|-5900028706170996[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: IdType#<get-value>(){}
|
||||
// Public signature: /IdType.value.<get-value>|3260093555963109437[0]
|
||||
get
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: IdType#<init>(kotlin.Int){}
|
||||
// Public signature: /IdType.<init>|-5182794243525578284[0]
|
||||
constructor(value: Int) /* primary */
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: CPointed
|
||||
// Public signature: /CPointed|null[0]
|
||||
interface CPointed {
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #foo(IdType;CInt32VarX<kotlin.Int>){}
|
||||
// Public signature: /foo|-5455779368502417749[0]
|
||||
fun foo(value: IdType, cv: CInt32VarX<Int>): Unit
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #reinterpret@CPointed(){0§<CPointed>}0:0
|
||||
// Public signature: /reinterpret|6686627751758834868[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #reinterpret@CPointed(){0§<CPointed>}
|
||||
// Public signature: /reinterpret|-1583466554098866733[0]
|
||||
inline fun <reified T : CPointed> CPointed.reinterpret(): T
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: @CInt32VarX<0:0>{0§<kotlin.Int>}value
|
||||
// Public signature: /value|-135689265793066449[0]
|
||||
var <T_INT : Int> CInt32VarX<T_INT>.value: T_INT
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #<get-value>@CInt32VarX<0:0>(){0§<kotlin.Int>}0:0
|
||||
// Public signature: /value.<get-value>|2596477086313818765[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #<get-value>@CInt32VarX<0:0>(){0§<kotlin.Int>}
|
||||
// Public signature: /value.<get-value>|7308799289468598697[0]
|
||||
get(): T_INT
|
||||
// CHECK:
|
||||
// Mangled name: #<set-value>@CInt32VarX<0:0>(0:0){0§<kotlin.Int>}
|
||||
// Public signature: /value.<set-value>|4371752181027190206[0]
|
||||
set(value: T_INT): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: CInt32Var
|
||||
// Public signature: /CInt32Var|null[0]
|
||||
typealias CInt32Var = CInt32VarX<Int>
|
||||
@@ -0,0 +1,32 @@
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #one(){}kotlin.Int
|
||||
// Public signature: /one|-1338778839794458943[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #one(){}
|
||||
// Public signature: /one|-883930323179095603[0]
|
||||
fun one(): Int
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #test1(){}kotlin.Int
|
||||
// Public signature: /test1|3246027394688469880[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #test1(){}
|
||||
// Public signature: /test1|4297044443957252634[0]
|
||||
fun test1(): Int
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #test2(){}kotlin.Int
|
||||
// Public signature: /test2|5542371834528279174[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #test2(){}
|
||||
// Public signature: /test2|4279114864133353152[0]
|
||||
fun test2(): Int
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #two(){}kotlin.Int
|
||||
// Public signature: /two|-3668245894055563667[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #two(){}
|
||||
// Public signature: /two|-8191816142589217386[0]
|
||||
fun two(): Int
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
// CHECK:
|
||||
// Mangled name: Child
|
||||
// Public signature: /Child|null[0]
|
||||
open class Child : Parent {
|
||||
// CHECK:
|
||||
// Mangled name: Child{}x
|
||||
// Public signature: /Child.x|-8060530855978347579[0]
|
||||
val x: Parent?
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: Child#<get-x>(){}Parent?
|
||||
// Public signature: /Child.x.<get-x>|-4268238355990068356[0]
|
||||
get
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: Child.QQQ
|
||||
// Public signature: /Child.QQQ|null[0]
|
||||
inner class QQQ {
|
||||
// CHECK:
|
||||
// Mangled name: Child.QQQ#<init>(){}
|
||||
// Public signature: /Child.QQQ.<init>|-5645683436151566731[0]
|
||||
constructor() /* primary */
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: Child.QQQ#z(){}
|
||||
// Public signature: /Child.QQQ.z|-6990221057904452282[0]
|
||||
fun z(): Unit
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: Child#<init>(Parent?){}
|
||||
// Public signature: /Child.<init>|690323910030303924[0]
|
||||
constructor(x: Parent?) /* primary */
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: Child#getQqq(){}kotlin.String?
|
||||
// Public signature: /Child.getQqq|2603726480275639305[0]
|
||||
/* fake */ override fun getQqq(): String?
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
// SKIP_KT_DUMP
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
|
||||
// MUTE_SIGNATURE_COMPARISON_K2: ANY
|
||||
// ^ KT-57429
|
||||
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.contract
|
||||
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
// CHECK:
|
||||
// Mangled name: NetRequestStatus
|
||||
// Public signature: /NetRequestStatus|null[0]
|
||||
sealed class NetRequestStatus<out T : Any> {
|
||||
// CHECK:
|
||||
// Mangled name: NetRequestStatus.Error
|
||||
// Public signature: /NetRequestStatus.Error|null[0]
|
||||
data class Error<out T : Any> : NetRequestStatus<T> {
|
||||
// CHECK:
|
||||
// Mangled name: NetRequestStatus.Error{}error
|
||||
// Public signature: /NetRequestStatus.Error.error|6099401258667737098[0]
|
||||
val error: Throwable
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: NetRequestStatus.Error#<get-error>(){}kotlin.Throwable
|
||||
// Public signature: /NetRequestStatus.Error.error.<get-error>|-5591110135270758069[0]
|
||||
get
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: NetRequestStatus.Error{}value
|
||||
// Public signature: /NetRequestStatus.Error.value|1987073854177347439[0]
|
||||
override val value: T?
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: NetRequestStatus.Error#<get-value>(){}1:0?
|
||||
// Public signature: /NetRequestStatus.Error.value.<get-value>|6345929521467247406[0]
|
||||
override get
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: NetRequestStatus.Error#<init>(kotlin.Throwable;1:0?){}
|
||||
// Public signature: /NetRequestStatus.Error.<init>|-1373568199086185373[0]
|
||||
constructor(error: Throwable, value: T?) /* primary */
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: NetRequestStatus.Error#component1(){}kotlin.Throwable
|
||||
// Public signature: /NetRequestStatus.Error.component1|2250146239720393392[0]
|
||||
operator fun component1(): Throwable
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: NetRequestStatus.Error#component2(){}1:0?
|
||||
// Public signature: /NetRequestStatus.Error.component2|8724683043803012713[0]
|
||||
operator fun component2(): T?
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: NetRequestStatus.Error#copy(kotlin.Throwable;1:0?){}NetRequestStatus.Error<1:0>
|
||||
// Public signature: /NetRequestStatus.Error.copy|1925006413771870834[0]
|
||||
fun copy(error: Throwable, value: T?): Error<T>
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: NetRequestStatus.Error#equals(kotlin.Any?){}kotlin.Boolean
|
||||
// Public signature: /NetRequestStatus.Error.equals|722809408929142791[0]
|
||||
override operator fun equals(other: Any?): Boolean
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: NetRequestStatus.Error#hashCode(){}kotlin.Int
|
||||
// Public signature: /NetRequestStatus.Error.hashCode|-8048879360829830756[0]
|
||||
override fun hashCode(): Int
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: NetRequestStatus.Error#toString(){}kotlin.String
|
||||
// Public signature: /NetRequestStatus.Error.toString|6958853723545266802[0]
|
||||
override fun toString(): String
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: NetRequestStatus#<init>(){}
|
||||
// Public signature: /NetRequestStatus.<init>|-5645683436151566731[0]
|
||||
protected constructor() /* primary */
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: NetRequestStatus{}value
|
||||
// Public signature: /NetRequestStatus.value|1987073854177347439[0]
|
||||
abstract val value: T?
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: NetRequestStatus#<get-value>(){}1:0?
|
||||
// Public signature: /NetRequestStatus.value.<get-value>|6345929521467247406[0]
|
||||
abstract get
|
||||
|
||||
}
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #isError@NetRequestStatus<0:0>(){0§<kotlin.Any>}kotlin.Boolean
|
||||
// Public signature: /isError|6754547245432239931[0]
|
||||
@OptIn(markerClass = [ExperimentalContracts::class])
|
||||
fun <T : Any> NetRequestStatus<T>.isError(): Boolean
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #successOrThrow(){0§<kotlin.Any>}
|
||||
// Public signature: /successOrThrow|8924064942759337382[0]
|
||||
fun <T : Any> successOrThrow(): Unit
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
// CHECK:
|
||||
// Mangled name: Inv2
|
||||
// Public signature: /Inv2|null[0]
|
||||
interface Inv2<A : Any?, B : Any?> {
|
||||
|
||||
}
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #box(){}kotlin.String
|
||||
// Public signature: /box|-9347091776561469[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #box(){}
|
||||
// Public signature: /box|2173511048851971368[0]
|
||||
fun box(): String
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #check(0:0;0:1;kotlin.Function1<0:0,0:1>){0§<kotlin.Any?>;1§<kotlin.Any?>}Inv2<0:0,0:1>
|
||||
// Public signature: /check|5984400751488580697[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #check(0:0;0:1;kotlin.Function1<0:0,0:1>){0§<kotlin.Any?>;1§<kotlin.Any?>}
|
||||
// Public signature: /check|-3580207389157345567[0]
|
||||
fun <T : Any?, R : Any?> check(x: T, y: R, f: Function1<T, R>): Inv2<T, R>
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #foo(){0§<kotlin.Any?>;1§<kotlin.Any?>}kotlin.Function1<0:0,0:1>
|
||||
// Public signature: /foo|-9122187844133412005[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #foo(){0§<kotlin.Any?>;1§<kotlin.Any?>}
|
||||
// Public signature: /foo|5215108069702224664[0]
|
||||
fun <X : Any?, Y : Any?> foo(): Function1<X, Y>
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #test(){}Inv2<kotlin.String,kotlin.Int>
|
||||
// Public signature: /test|1156894151612153537[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #test(){}
|
||||
// Public signature: /test|6620506149988718649[0]
|
||||
fun test(): Inv2<String, Int>
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// MUTE_SIGNATURE_COMPARISON_K2: JVM_IR
|
||||
// ^ KT-57429
|
||||
|
||||
class A<Q>(val q: Q)
|
||||
|
||||
typealias B<X> = A<X>
|
||||
@@ -7,4 +10,4 @@ typealias B2<T> = A<A<T>>
|
||||
fun bar() {
|
||||
val b = B(2)
|
||||
val b2 = B2(b)
|
||||
}
|
||||
}
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
// CHECK:
|
||||
// Mangled name: A
|
||||
// Public signature: /A|null[0]
|
||||
class A<Q : Any?> {
|
||||
// CHECK:
|
||||
// Mangled name: A{}q
|
||||
// Public signature: /A.q|3274930974999175741[0]
|
||||
val q: Q
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: A#<get-q>(){}1:0
|
||||
// Public signature: /A.q.<get-q>|-447041854451904985[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: A#<get-q>(){}
|
||||
// Public signature: /A.q.<get-q>|-39243554116721919[0]
|
||||
get
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: A#<init>(1:0){}
|
||||
// Public signature: /A.<init>|-8731461708390519279[0]
|
||||
constructor(q: Q) /* primary */
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #bar(){}
|
||||
// Public signature: /bar|496682602797471549[0]
|
||||
fun bar(): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: B
|
||||
// Public signature: /B|null[0]
|
||||
typealias B<X : Any?> = A<X>
|
||||
// CHECK:
|
||||
// Mangled name: B2
|
||||
// Public signature: /B2|null[0]
|
||||
typealias B2<T : Any?> = A<A<T>>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #problematic(kotlin.collections.List<kotlin.collections.List<0:0>>){0§<kotlin.Any?>}kotlin.collections.List<0:0>
|
||||
// Public signature: /problematic|-8622452458410513914[0]
|
||||
fun <T : Any?> problematic(lss: List<List<T>>): List<T>
|
||||
|
||||
Reference in New Issue
Block a user