[Commonizer] HierarchicalClassAndTypeAliasCommonizationTest: Un-ignore tests fore ^KT-47432 and ^KT-47434 and add additional test's

This commit is contained in:
sebastian.sellmair
2021-06-29 14:42:16 +02:00
committed by Space
parent fc75486611
commit 8e2780345c
2 changed files with 100 additions and 6 deletions
@@ -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
@@ -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<T>
class X
fun useBox(x: Box<X>)
""".trimIndent()
)
simpleSingleSourceTarget(
"b", """
class Box<T>
class B
typealias X = B
fun useBox(x: Box<X>)
""".trimIndent()
)
}
result.assertCommonized(
"(a, b)", """
expect class Box<T> expect constructor()
expect class X expect constructor()
expect fun useBox(x: Box<X>)
""".trimIndent()
)
}
fun `test boxed parameter in function - TA expansion not commonized`() {
val result = commonize {
outputTarget("(a, b)")
simpleSingleSourceTarget(
"a", """
class Box<T>
class A
typealias X = A
fun useBox(x: Box<X>)
""".trimIndent()
)
simpleSingleSourceTarget(
"b", """
class Box<T>
class B
typealias X = B
fun useBox(x: Box<X>)
""".trimIndent()
)
}
result.assertCommonized(
"(a, b)", """
expect class Box<T> expect constructor()
expect class X expect constructor()
expect fun useBox(x: Box<X>)
""".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<T>
class A
typealias X = A
fun x(x: Box<X>)
""".trimIndent()
)
simpleSingleSourceTarget(
"b", """
class Box<T>
class B
typealias X = B
fun x(x: Box<B>)
""".trimIndent()
)
}
result.assertCommonized(
"(a, b)", """
expect class Box<T> expect constructor()
expect class X expect constructor()
expect fun x(x: Box<X>)
""".trimIndent()
)
}
}