icerockdev / moko-kswift

Swift-friendly api generator for Kotlin/Native frameworks
https://moko.icerock.dev
Apache License 2.0
348 stars 21 forks source link

Generic class inside sealed class not generated properly #86

Open radimjanda754 opened 12 months ago

radimjanda754 commented 12 months ago

Following code

sealed class ResourceState<out R> {

    data class Success<out T>(val data: T) : ResourceState<T>()
    data class Error(val throwable: Throwable) : ResourceState<Nothing>()
    object Loading : ResourceState<Nothing>()
    object Empty : ResourceState<Nothing>()

}

Generates generic class type T like this

public enum ResourceStateKs<R : AnyObject> {

  case empty
  case error(ResourceStateError)
  case loading
  case success(ResourceStateSuccess<T>)
  ...

Which says Cannot find type 'T' in scope.

I guess it should've been something like this

public enum ResourceStateKs<R : AnyObject, T: AnyObject> {

  case empty
  case error(ResourceStateError)
  case loading
  case success(ResourceStateSuccess<T>)
  ...

Is it possible to fix this and generate properly?