diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/CommonizerHierarchicalIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/CommonizerHierarchicalIT.kt index 736c307e276..da11b6ecdf7 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/CommonizerHierarchicalIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/CommonizerHierarchicalIT.kt @@ -153,6 +153,16 @@ class CommonizerHierarchicalIT : BaseGradleIT() { } } + @Test + fun `test KT-52050 - DIR retains CPointed supertype`() { + with(Project("commonize-kt-52050-DIR-supertype")) { + build(":compileCommonMainKotlinMetadata") { + assertNotContains("Unresolved reference") + assertSuccessful() + } + } + } + private object Os { private val os = OperatingSystem.current() val canCompileApple get() = os.isMacOsX diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/commonize-kt-52050-DIR-supertype/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/commonize-kt-52050-DIR-supertype/build.gradle.kts new file mode 100644 index 00000000000..a3a543c9d8b --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/commonize-kt-52050-DIR-supertype/build.gradle.kts @@ -0,0 +1,24 @@ +plugins { + kotlin("multiplatform") +} + +repositories { + mavenLocal() + mavenCentral() +} + +kotlin { + macosX64("macos") + linuxX64("linux") + mingwX64("windows") + + val commonMain by sourceSets.getting + val macosMain by sourceSets.getting + val linuxMain by sourceSets.getting + + val unixMain by sourceSets.creating + + unixMain.dependsOn(commonMain) + linuxMain.dependsOn(unixMain) + macosMain.dependsOn(unixMain) +} diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/commonize-kt-52050-DIR-supertype/src/commonMain/kotlin/CommonMain.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/commonize-kt-52050-DIR-supertype/src/commonMain/kotlin/CommonMain.kt new file mode 100644 index 00000000000..56084734fc2 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/commonize-kt-52050-DIR-supertype/src/commonMain/kotlin/CommonMain.kt @@ -0,0 +1,17 @@ +@file:Suppress("UNUSED_PARAMETER") + +import kotlinx.cinterop.CPointed +import platform.posix.DIR + +fun requireCPointed(value: CPointed): Unit = error("Not supported") +fun DIR(): DIR = error("Not supported") + +fun main() { + /* + Linux and Windows Hosts failed to retain + CPointed supertype of `DIR` when commonizing. + This happened in the special case of 'single platform propagation', which + lost forward declarations from one step to the next. + */ + requireCPointed(DIR()) +}