[ObjCExport] Support generic type parameters for ObjC translation
^KT-65167
This commit is contained in:
committed by
Space Team
parent
3111678f8b
commit
3cd20bd7b0
+41
@@ -403,6 +403,19 @@ class ObjCExportTypeTranslationTest(
|
||||
assertEquals("T _Nullable -> void", header.renderTypesOfSymbol("foo"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test - class with generic function`() {
|
||||
val header = header(
|
||||
"""
|
||||
class A {
|
||||
fun <T: Any> foo(value: T) = Unit
|
||||
}
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
assertEquals("id -> void", header.renderTypesOfSymbol("foo"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test - generic class with bounds with function`() {
|
||||
val header = header(
|
||||
@@ -416,6 +429,34 @@ class ObjCExportTypeTranslationTest(
|
||||
assertEquals("T -> void", header.renderTypesOfSymbol("foo"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test - nested classes with same type parameter`() {
|
||||
val header = header(
|
||||
"""
|
||||
class A<T: Any> {
|
||||
class B<T: Any> {
|
||||
fun foo(value: T) = Unit
|
||||
}
|
||||
}
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
assertEquals("T -> void", header.renderTypesOfSymbol("foo"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test - classes with same type parameter as function`() {
|
||||
val header = header(
|
||||
"""
|
||||
class A<T: Any> {
|
||||
fun <T: Any> foo(value: T) = Unit
|
||||
}
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
assertEquals("id -> void", header.renderTypesOfSymbol("foo"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test - unresolved error type`() {
|
||||
val header = header(
|
||||
|
||||
Reference in New Issue
Block a user