6e8283a6fe
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
54 lines
1.0 KiB
Kotlin
Vendored
54 lines
1.0 KiB
Kotlin
Vendored
// MUTE_SIGNATURE_COMPARISON_K2: ANY
|
|
// ^ KT-57436
|
|
|
|
import C.f
|
|
import C.p
|
|
import C.ext
|
|
import C.g1
|
|
import C.g2
|
|
import C.fromClass
|
|
import C.fromInterface
|
|
import C.genericFromSuper
|
|
|
|
interface I<G> {
|
|
fun <T> T.fromInterface(): T = this
|
|
|
|
fun genericFromSuper(g: G) = g
|
|
}
|
|
|
|
open class BaseClass {
|
|
val <T> T.fromClass: T
|
|
get() = this
|
|
}
|
|
|
|
object C: BaseClass(), I<String> {
|
|
fun f(s: Int) = 1
|
|
fun f(s: String) = 2
|
|
fun Boolean.f() = 3
|
|
|
|
var p: Int = 4
|
|
val Int.ext: Int
|
|
get() = 6
|
|
|
|
fun <T> g1(t: T): T = t
|
|
val <T> T.g2: T
|
|
get() = this
|
|
}
|
|
|
|
fun box(): String {
|
|
if (f(1) != 1) return "1"
|
|
if (f("s") != 2) return "2"
|
|
if (true.f() != 3) return "3"
|
|
if (p != 4) return "4"
|
|
p = 5
|
|
if (p != 5) return "5"
|
|
if (5.ext != 6) return "6"
|
|
if (g1("7") != "7") return "7"
|
|
if ("8".g2 != "8") return "8"
|
|
if (9.fromInterface() != 9) return "9"
|
|
if ("10".fromClass != "10") return "10"
|
|
if (genericFromSuper("11") != "11") return "11"
|
|
|
|
return "OK"
|
|
}
|