diff --git a/native/commonizer/tests/org/jetbrains/kotlin/commonizer/hierarchical/ParameterizedTypesCommonizationTest.kt b/native/commonizer/tests/org/jetbrains/kotlin/commonizer/hierarchical/ParameterizedTypesCommonizationTest.kt index 9c6f11d345c..d96bfdada07 100644 --- a/native/commonizer/tests/org/jetbrains/kotlin/commonizer/hierarchical/ParameterizedTypesCommonizationTest.kt +++ b/native/commonizer/tests/org/jetbrains/kotlin/commonizer/hierarchical/ParameterizedTypesCommonizationTest.kt @@ -287,4 +287,81 @@ class ParameterizedTypesCommonizationTest : AbstractInlineSourcesCommonizationTe """.trimIndent() ) } + + fun `test parameterized function - 0`() { + val result = commonize { + outputTarget("(a, b)") + simpleSingleSourceTarget( + "a", """ + typealias X = Map + fun x(x: X) + """.trimIndent() + ) + + simpleSingleSourceTarget( + "b", """ + fun x(x: Map) + """.trimIndent() + ) + } + + result.assertCommonized( + "(a, b)", """ + expect fun x(x: Map) + """.trimIndent() + ) + } + + fun `test parameterized function - 1`() { + val result = commonize { + outputTarget("(a, b)") + + simpleSingleSourceTarget( + "a", """ + typealias X = Map + fun > x(x: X) + """.trimIndent() + ) + + simpleSingleSourceTarget( + "b", """ + fun > x(x: Map) + """.trimIndent() + ) + } + + result.assertCommonized( + "(a, b)", """ + expect fun > x(x: Map) + """.trimIndent() + ) + } + + fun `test parameterized function - 2`() { + val result = commonize { + outputTarget("(a, b)") + + simpleSingleSourceTarget( + "a", """ + typealias X = Map + fun > x(x: X) + """.trimIndent() + ) + + simpleSingleSourceTarget( + "b", """ + typealias X = Map + typealias Y = X + fun > x(x: Y) + """.trimIndent() + ) + } + + result.assertCommonized( + "(a, b)", """ + expect typealias X = Map + expect fun > x(x: X) + """.trimIndent() + ) + } }