https://kotlinlang.org logo
#kotlin-native
Title
# kotlin-native
a

ankushg

07/21/2022, 8:51 PM
Hey all, not sure if this is a known issue or not: I have a Kotlin interface hierarchy with something like this:
Copy code
sealed interface MyCollectionClass {
  val collection: Collection<String>
}

data class MyListClass: MyCollectionClass {
  override val collection: List<String>
}

data class MySetClass: MyCollectionClass {
  override val collection: Set<String>
}
Within Kotlin, when we that our concrete type is a
MyListClass
, we also know that
collection
is of type
List<String>
But in Swift, even when we know we have an instance of
MyListClass
, the type of
collection
looks like a
Collection<String>
I think this is only the case with `sealed interface`s — `sealed class`es seem to be working as expected.