kopykat-kt / kopykat

Little utilities for more pleasant immutable data in Kotlin
Other
283 stars 16 forks source link

Variance annotations are only allowed for type parameters of classes and interfaces #48

Closed pablobaldez closed 2 years ago

pablobaldez commented 2 years ago

I'm trying to generate a generic data class and I'm receiving the following error during the build This is the class

@Serializable
@Keep
data class Node<out T>(
    val current: T,
    val paths: List<Node<T>>,
)

here is the error: e: /Users/pablo/Documents/dev/mob1st/bet-app-android/app/build/generated/ksp/debug/kotlin/br/com/mob1st/bet/core/utils/objects/br.com.mob1st.bet.core.utils.objects.Node$CopyMap.kt: (8, 20): Variance annotations are only allowed for type parameters of classes and interfaces

Am I doing anything wrong?

serras commented 2 years ago

Thanks for reporting this! A fix is on the go in #47, the code was reusing the out from the declaration in the function type, and this is not allowed. But now your code is part of our test suite 😄