mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
[Commonizer] HierarchicalClassAndTypeAliasCommonizationTest: Add function parameter tests
This commit is contained in:
committed by
Space
parent
4bcae0cc6f
commit
eaa0eb2851
@@ -309,6 +309,62 @@ class HierarchicalClassAndTypeAliasCommonizationTest : AbstractInlineSourcesComm
|
||||
)
|
||||
}
|
||||
|
||||
fun `test parameters`() {
|
||||
val result = commonize {
|
||||
outputTarget("(a, b)")
|
||||
|
||||
simpleSingleSourceTarget(
|
||||
"a", """
|
||||
class X
|
||||
fun useX(x: X) = Unit
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
simpleSingleSourceTarget(
|
||||
"b", """
|
||||
class B
|
||||
typealias X = B
|
||||
fun useX(x: X) = Unit
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
result.assertCommonized(
|
||||
"(a, b)", """
|
||||
expect class X expect constructor()
|
||||
expect fun useX(x: X)
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
fun `test parameters with non-commonized TA expanding to a commonized type`() {
|
||||
val result = commonize {
|
||||
outputTarget("(a, b)")
|
||||
|
||||
simpleSingleSourceTarget(
|
||||
"a", """
|
||||
class X
|
||||
fun useX(x: X) = Unit
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
simpleSingleSourceTarget(
|
||||
"b", """
|
||||
class X
|
||||
typealias B = X
|
||||
fun useX(x: B) = Unit
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
result.assertCommonized(
|
||||
"(a, b)", """
|
||||
expect class X expect constructor()
|
||||
expect fun useX(x: X)
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
fun `test parameterized types`() {
|
||||
val result = commonize {
|
||||
outputTarget("(a, b)", "(c, d)", "(a, b, c, d)")
|
||||
|
||||
Reference in New Issue
Block a user