diff --git a/native/commonizer/testData/classifierCommonization/typeAliases/commonized/common/package_root.kt b/native/commonizer/testData/classifierCommonization/typeAliases/commonized/common/package_root.kt index 8e1b815a5c5..821a9bad925 100644 --- a/native/commonizer/testData/classifierCommonization/typeAliases/commonized/common/package_root.kt +++ b/native/commonizer/testData/classifierCommonization/typeAliases/commonized/common/package_root.kt @@ -40,7 +40,7 @@ typealias U = A // same nullability of the RHS class expect class V // different nullability of the RHS class typealias W = A // same nullability of the RHS TA expect class X // different nullability of the RHS TA -typealias Y = V // TA at the RHS with the different nullability of own RHS +expect class Y // TA at the RHS with the different nullability of own RHS // Supertypes: expect class FILE expect constructor(): kotlinx.cinterop.CStructVar diff --git a/native/commonizer/tests/org/jetbrains/kotlin/commonizer/hierarchical/HierarchicalClassAndTypeAliasCommonizationTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/commonizer/hierarchical/HierarchicalClassAndTypeAliasCommonizationTest.kt index 1b1173d421b..8a14f3c74fa 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/commonizer/hierarchical/HierarchicalClassAndTypeAliasCommonizationTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/commonizer/hierarchical/HierarchicalClassAndTypeAliasCommonizationTest.kt @@ -7,7 +7,6 @@ package org.jetbrains.kotlin.commonizer.hierarchical import org.jetbrains.kotlin.commonizer.AbstractInlineSourcesCommonizationTest import org.jetbrains.kotlin.commonizer.assertCommonized -import org.junit.Ignore import org.junit.Test class HierarchicalClassAndTypeAliasCommonizationTest : AbstractInlineSourcesCommonizationTest() { @@ -248,7 +247,7 @@ class HierarchicalClassAndTypeAliasCommonizationTest : AbstractInlineSourcesComm "(a, b)", """ expect class AB expect constructor() expect class V - typealias Y = V + expect class Y """.trimIndent() ) } @@ -283,7 +282,7 @@ class HierarchicalClassAndTypeAliasCommonizationTest : AbstractInlineSourcesComm } @Suppress("unused") - fun `ignored KT-47432 - test return types`() { + fun `test return types`() { val result = commonize { outputTarget("(a, b)") @@ -312,7 +311,7 @@ class HierarchicalClassAndTypeAliasCommonizationTest : AbstractInlineSourcesComm } @Suppress("unused") - fun `ignored KT-47432 - test function parameters`() { + fun `test function parameters`() { val result = commonize { outputTarget("(a, b)") @@ -370,7 +369,7 @@ class HierarchicalClassAndTypeAliasCommonizationTest : AbstractInlineSourcesComm } @Suppress("unused") - fun `ignored KT-47434 - test parameterized return type`() { + fun `test parameterized return type`() { val result = commonize { outputTarget("(a, b)", "(c, d)", "(a, b, c, d)") registerDependency("a", "b", "c", "d", "(a, b)", "(c, d)", "(a, b, c, d)") { @@ -428,6 +427,69 @@ class HierarchicalClassAndTypeAliasCommonizationTest : AbstractInlineSourcesComm ) } + fun `test boxed parameter in function`() { + val result = commonize { + outputTarget("(a, b)") + + simpleSingleSourceTarget( + "a", """ + class Box + class X + fun useBox(x: Box) + """.trimIndent() + ) + + simpleSingleSourceTarget( + "b", """ + class Box + class B + typealias X = B + fun useBox(x: Box) + """.trimIndent() + ) + } + + result.assertCommonized( + "(a, b)", """ + expect class Box expect constructor() + expect class X expect constructor() + expect fun useBox(x: Box) + """.trimIndent() + ) + } + + fun `test boxed parameter in function - TA expansion not commonized`() { + val result = commonize { + outputTarget("(a, b)") + + simpleSingleSourceTarget( + "a", """ + class Box + class A + typealias X = A + fun useBox(x: Box) + """.trimIndent() + ) + + simpleSingleSourceTarget( + "b", """ + class Box + class B + typealias X = B + fun useBox(x: Box) + """.trimIndent() + ) + } + + result.assertCommonized( + "(a, b)", """ + expect class Box expect constructor() + expect class X expect constructor() + expect fun useBox(x: Box) + """.trimIndent() + ) + } + @Test fun `test supertype from dependency`() { val result = commonize { @@ -485,4 +547,36 @@ class HierarchicalClassAndTypeAliasCommonizationTest : AbstractInlineSourcesComm """.trimIndent() ) } + + fun `todo - test boxed function using TA and expanded type`() { + val result = commonize { + outputTarget("(a, b)") + + simpleSingleSourceTarget( + "a", """ + class Box + class A + typealias X = A + fun x(x: Box) + """.trimIndent() + ) + + simpleSingleSourceTarget( + "b", """ + class Box + class B + typealias X = B + fun x(x: Box) + """.trimIndent() + ) + } + + result.assertCommonized( + "(a, b)", """ + expect class Box expect constructor() + expect class X expect constructor() + expect fun x(x: Box) + """.trimIndent() + ) + } }