[klib] Add a test ensuring that signature clash detection works w/ MPP

This commit is contained in:
Sergej Jaskiewicz
2024-01-23 20:41:18 +01:00
committed by Space Team
parent 03aa14b473
commit f84fa29fef
3 changed files with 40 additions and 0 deletions
@@ -0,0 +1,16 @@
Module: common
/common.kt:7:1: error: Platform declaration clash: The following declarations have the same IR signature (/foo|foo(){}[0]):
fun foo(): kotlin.Int defined in root package
fun foo(): kotlin.String defined in root package
/common.kt:10:1: error: Platform declaration clash: The following declarations have the same IR signature (/bar|bar(B){}[0]):
fun bar(x: B): kotlin.Int defined in root package
fun bar(x: B): kotlin.Int defined in root package
Module: platform
/platform.kt:14:1: error: Platform declaration clash: The following declarations have the same IR signature (/foo|foo(){}[0]):
fun foo(): kotlin.Int defined in root package
fun foo(): kotlin.String defined in root package
/platform.kt:18:1: error: Platform declaration clash: The following declarations have the same IR signature (/bar|bar(B){}[0]):
fun bar(x: B): kotlin.Int defined in root package
fun bar(x: B): kotlin.Int defined in root package
@@ -0,0 +1,18 @@
// LANGUAGE: +MultiPlatformProjects
// FIR_IDENTICAL
// RENDER_ALL_DIAGNOSTICS_FULL_TEXT
// MODULE: common
// FILE: common.kt
<!CONFLICTING_KLIB_SIGNATURES_ERROR!>fun foo(): String = ""<!>
expect class A
<!CONFLICTING_KLIB_SIGNATURES_ERROR!>fun bar(x: A): Int = 2<!>
// MODULE: platform()()(common)
// FILE: platform.kt
<!CONFLICTING_KLIB_SIGNATURES_ERROR!>fun foo(): Int = 0<!>
class B
actual typealias A = B
<!CONFLICTING_KLIB_SIGNATURES_ERROR!>fun bar(x: B): Int = 3<!>