[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
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// CHECK:
|
||||
// Mangled name: IRunnable
|
||||
// Public signature: /IRunnable|null[0]
|
||||
fun interface IRunnable {
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: IRunnable#run(){}
|
||||
// Public signature: /IRunnable.run|-991178076551934874[0]
|
||||
abstract fun run(): Unit
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #foo1(IRunnable;kotlin.Array<out|kotlin.String>...){}
|
||||
// Public signature: /foo1|8109256075034655920[0]
|
||||
fun foo1(r: IRunnable, vararg s: String): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #foo2(IRunnable;IRunnable;kotlin.Array<out|kotlin.String>...){}
|
||||
// Public signature: /foo2|-847052428556006975[0]
|
||||
fun foo2(r1: IRunnable, r2: IRunnable, vararg s: String): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #test(kotlin.Function0<kotlin.Unit>;IRunnable;kotlin.String;kotlin.Array<kotlin.String>){}
|
||||
// Public signature: /test|8261026842322841823[0]
|
||||
fun test(fn: Function0<Unit>, r: IRunnable, s: String, arr: Array<String>): Unit
|
||||
|
||||
+4
@@ -1,4 +1,8 @@
|
||||
// FIR_IDENTICAL
|
||||
// DUMP_LOCAL_DECLARATION_SIGNATURES
|
||||
|
||||
// MUTE_SIGNATURE_COMPARISON_K2: ANY
|
||||
// ^ KT-57428
|
||||
|
||||
fun interface Foo {
|
||||
fun invoke(): String
|
||||
|
||||
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
// CHECK:
|
||||
// Mangled name: Foo
|
||||
// Public signature: /Foo|null[0]
|
||||
fun interface Foo {
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: Foo#invoke(){}kotlin.String
|
||||
// Public signature: /Foo.invoke|8861605044563078664[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: Foo#invoke(){}
|
||||
// Public signature: /Foo.invoke|-4663091332620260873[0]
|
||||
abstract fun invoke(): String
|
||||
|
||||
}
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #foo(Foo){}kotlin.String
|
||||
// Public signature: /foo|-5888774885663875480[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #foo(Foo){}
|
||||
// Public signature: /foo|-8233162121880232317[0]
|
||||
fun foo(f: Foo): String
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #test(){}kotlin.String
|
||||
// Public signature: /test|-7008832412320199001[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #test(){}
|
||||
// Public signature: /test|6620506149988718649[0]
|
||||
fun test(): String
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #test(){}kotlin.String#<anonymous>#static(){}kotlin.String
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #test(){}#<anonymous>#static(){}
|
||||
local fun <anonymous>(): String
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// CHECK:
|
||||
// Mangled name: KRunnable
|
||||
// Public signature: /KRunnable|null[0]
|
||||
fun interface KRunnable {
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: KRunnable#invoke(){}
|
||||
// Public signature: /KRunnable.invoke|-4663091332620260873[0]
|
||||
abstract fun invoke(): Unit
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #test(kotlin.Any?){}
|
||||
// Public signature: /test|4942271194395271693[0]
|
||||
fun test(a: Any?): Unit
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// CHECK:
|
||||
// Mangled name: Foo
|
||||
// Public signature: /Foo|null[0]
|
||||
fun interface Foo : Function0<Int> {
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: Foo#invoke(){}kotlin.Int
|
||||
// Public signature: /Foo.invoke|906964710558498066[0]
|
||||
abstract /* fake */ override operator fun invoke(): Int
|
||||
|
||||
}
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #id(Foo){}kotlin.Any
|
||||
// Public signature: /id|-7816997914602483733[0]
|
||||
fun id(foo: Foo): Any
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #test(Foo){}
|
||||
// Public signature: /test|1185534388124909890[0]
|
||||
fun test(foo: Foo): Unit
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
// MUTE_SIGNATURE_COMPARISON_K2: JS_IR
|
||||
// MUTE_SIGNATURE_COMPARISON_K2: NATIVE
|
||||
// ^ KT-57818
|
||||
|
||||
fun interface Fn<T, R> {
|
||||
fun run(s: String, i: Int, t: T): R
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
// CHECK:
|
||||
// Mangled name: {}fsi
|
||||
// Public signature: /fsi|5902301571547257746[0]
|
||||
val fsi: Fn<String, Int>
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #<get-fsi>(){}Fn<kotlin.String,kotlin.Int>
|
||||
// Public signature: /fsi.<get-fsi>|-2546794996796226350[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #<get-fsi>(){}
|
||||
// Public signature: /fsi.<get-fsi>|211056100616532240[0]
|
||||
get
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: {}fis
|
||||
// Public signature: /fis|4743015834142814854[0]
|
||||
val fis: Fn<Int, String>
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #<get-fis>(){}Fn<kotlin.Int,kotlin.String>
|
||||
// Public signature: /fis.<get-fis>|5252092316637653538[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #<get-fis>(){}
|
||||
// Public signature: /fis.<get-fis>|-3144498278709673820[0]
|
||||
get
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: J
|
||||
// Public signature: /J|null[0]
|
||||
class J {
|
||||
// CHECK:
|
||||
// Mangled name: J#<init>(){}
|
||||
// Public signature: /J.<init>|-5645683436151566731[0]
|
||||
constructor() /* primary */
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: J#runConversion(Fn<kotlin.String,kotlin.Int>;Fn<kotlin.Int,kotlin.String>){}kotlin.Int
|
||||
// Public signature: /J.runConversion|4347513371052535712[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: J#runConversion(Fn<kotlin.String,kotlin.Int>;Fn<kotlin.Int,kotlin.String>){}
|
||||
// Public signature: /J.runConversion|-3250437629905581865[0]
|
||||
fun runConversion(f1: Fn<String, Int>, f2: Fn<Int, String>): Int
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: Fn
|
||||
// Public signature: /Fn|null[0]
|
||||
fun interface Fn<T : Any?, R : Any?> {
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: Fn#run(kotlin.String;kotlin.Int;1:0){}1:1
|
||||
// Public signature: /Fn.run|6229634511602909233[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: Fn#run(kotlin.String;kotlin.Int;1:0){}
|
||||
// Public signature: /Fn.run|-3043809751901738692[0]
|
||||
abstract fun run(s: String, i: Int, t: T): R
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #test(J){}
|
||||
// Public signature: /test|-8477572416399964095[0]
|
||||
fun test(j: J): Unit
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
// CHECK:
|
||||
// Mangled name: IFoo
|
||||
// Public signature: /IFoo|null[0]
|
||||
fun interface IFoo {
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: IFoo#foo(kotlin.Int){}
|
||||
// Public signature: /IFoo.foo|-104159190164110731[0]
|
||||
abstract fun foo(i: Int): Unit
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #testAdaptedCR(){}
|
||||
// Public signature: /testAdaptedCR|-2000726175248606[0]
|
||||
fun testAdaptedCR(): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #testLambda(){}
|
||||
// Public signature: /testLambda|-124997257399938843[0]
|
||||
fun testLambda(): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #testSeveralLambdas(){}
|
||||
// Public signature: /testSeveralLambdas|884186753581284332[0]
|
||||
fun testSeveralLambdas(): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #useVararg(kotlin.Array<out|IFoo>...){}
|
||||
// Public signature: /useVararg|-167843892719966590[0]
|
||||
fun useVararg(vararg foos: IFoo): Unit
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #withVarargOfInt(kotlin.IntArray...){}kotlin.String
|
||||
// Public signature: /withVarargOfInt|-4664776409518571139[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #withVarargOfInt(kotlin.IntArray...){}
|
||||
// Public signature: /withVarargOfInt|-232972314185863621[0]
|
||||
fun withVarargOfInt(vararg xs: Int): String
|
||||
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// CHECK:
|
||||
// Mangled name: MyRunnable
|
||||
// Public signature: /MyRunnable|null[0]
|
||||
fun interface MyRunnable {
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: MyRunnable#run(){}
|
||||
// Public signature: /MyRunnable.run|-991178076551934874[0]
|
||||
abstract fun run(): Unit
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #foo(kotlin.Array<out|MyRunnable>...){}
|
||||
// Public signature: /foo|6689815842309055774[0]
|
||||
fun foo(vararg rs: MyRunnable): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #test(kotlin.Any;MyRunnable){}
|
||||
// Public signature: /test|-2252565057874021036[0]
|
||||
fun test(a: Any, r: MyRunnable): Unit
|
||||
|
||||
Vendored
+56
@@ -0,0 +1,56 @@
|
||||
// CHECK:
|
||||
// Mangled name: KRunnable
|
||||
// Public signature: /KRunnable|null[0]
|
||||
fun interface KRunnable {
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: KRunnable#run(){}
|
||||
// Public signature: /KRunnable.run|-991178076551934874[0]
|
||||
abstract fun run(): Unit
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #foo0(){}
|
||||
// Public signature: /foo0|854950155582184407[0]
|
||||
fun foo0(): Unit
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #foo1(kotlin.IntArray...){}kotlin.Int
|
||||
// Public signature: /foo1|7470134185704818303[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #foo1(kotlin.IntArray...){}
|
||||
// Public signature: /foo1|-6748328364529290172[0]
|
||||
fun foo1(vararg xs: Int): Int
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #testSamConstructor(){}KRunnable
|
||||
// Public signature: /testSamConstructor|-5482155559435579976[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #testSamConstructor(){}
|
||||
// Public signature: /testSamConstructor|-7853436018033066699[0]
|
||||
fun testSamConstructor(): KRunnable
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #testSamConversion(){}
|
||||
// Public signature: /testSamConversion|8522656930427711360[0]
|
||||
fun testSamConversion(): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #testSamConversionOnAdapted(){}
|
||||
// Public signature: /testSamConversionOnAdapted|2809940309834714371[0]
|
||||
fun testSamConversionOnAdapted(): Unit
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #testSamCosntructorOnAdapted(){}KRunnable
|
||||
// Public signature: /testSamCosntructorOnAdapted|655519272240812814[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #testSamCosntructorOnAdapted(){}
|
||||
// Public signature: /testSamCosntructorOnAdapted|-7927635342265674772[0]
|
||||
fun testSamCosntructorOnAdapted(): KRunnable
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #use(KRunnable){}
|
||||
// Public signature: /use|3076420774911186780[0]
|
||||
fun use(r: KRunnable): Unit
|
||||
|
||||
Vendored
+107
@@ -0,0 +1,107 @@
|
||||
// CHECK:
|
||||
// Mangled name: KRunnable
|
||||
// Public signature: /KRunnable|null[0]
|
||||
fun interface KRunnable {
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: KRunnable#run(){}
|
||||
// Public signature: /KRunnable.run|-991178076551934874[0]
|
||||
abstract fun run(): Unit
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: Unrelated
|
||||
// Public signature: /Unrelated|null[0]
|
||||
interface Unrelated {
|
||||
|
||||
}
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #id(0:0){0§<kotlin.Any?>}0:0
|
||||
// Public signature: /id|-6791396263062521506[0]
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #id(0:0){0§<kotlin.Any?>}
|
||||
// Public signature: /id|9187295668833355463[0]
|
||||
fun <T : Any?> id(x: T): T
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #run1(KRunnable){}
|
||||
// Public signature: /run1|2612844463130679128[0]
|
||||
fun run1(r: KRunnable): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #run2(KRunnable;KRunnable){}
|
||||
// Public signature: /run2|8208068882257438869[0]
|
||||
fun run2(r1: KRunnable, r2: KRunnable): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #test0(0:0){0§<KRunnable&kotlin.Function0<kotlin.Unit>>}
|
||||
// Public signature: /test0|7203793719980108226[0]
|
||||
fun <T> test0(a: T): Unit where T : KRunnable, T : Function0<Unit>
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #test1(kotlin.Function0<kotlin.Unit>){}
|
||||
// Public signature: /test1|-2870537507416699845[0]
|
||||
fun test1(a: Function0<Unit>): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #test2(KRunnable){}
|
||||
// Public signature: /test2|-6262171320756539088[0]
|
||||
fun test2(a: KRunnable): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #test3(kotlin.Function0<kotlin.Unit>){}
|
||||
// Public signature: /test3|-1760685804488672424[0]
|
||||
fun test3(a: Function0<Unit>): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #test4(kotlin.Function0<kotlin.Unit>;kotlin.Function0<kotlin.Unit>){}
|
||||
// Public signature: /test4|1443124276429499957[0]
|
||||
fun test4(a: Function0<Unit>, b: Function0<Unit>): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #test5(kotlin.Any){}
|
||||
// Public signature: /test5|4504681808078971124[0]
|
||||
fun test5(a: Any): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #test5x(kotlin.Any){}
|
||||
// Public signature: /test5x|8044678810048210306[0]
|
||||
fun test5x(a: Any): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #test6(kotlin.Any){}
|
||||
// Public signature: /test6|-7590017673454141671[0]
|
||||
fun test6(a: Any): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #test7(kotlin.Function1<kotlin.Int,kotlin.Int>){}
|
||||
// Public signature: /test7|1095013294548842913[0]
|
||||
fun test7(a: Function1<Int, Int>): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #test7a(0:0){0§<kotlin.Function1<kotlin.Int,kotlin.Int>>}
|
||||
// Public signature: /test7a|4611209577080015095[0]
|
||||
fun <T : Function1<Int, Int>> test7a(a: T): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #test7b(0:0){0§<kotlin.Function1<kotlin.Int,kotlin.Unit>&kotlin.Function0<kotlin.Unit>>}
|
||||
// Public signature: /test7b|4558127648037232116[0]
|
||||
fun <T> test7b(a: T): Unit where T : Function0<Unit>, T : Function1<Int, Unit>
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #test7c(0:0){0§<Unrelated&kotlin.Function0<kotlin.Unit>>}
|
||||
// Public signature: /test7c|-2955596188911782407[0]
|
||||
fun <T> test7c(a: T): Unit where T : Unrelated, T : Function0<Unit>
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #test8(kotlin.Function0<kotlin.Unit>){}
|
||||
// Public signature: /test8|8321269803549472585[0]
|
||||
fun test8(a: Function0<Unit>): Unit
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: #test9(){}
|
||||
// Public signature: /test9|9214787561267119658[0]
|
||||
fun test9(): Unit
|
||||
|
||||
Reference in New Issue
Block a user