Dario Valdespino
08/15/2021, 5:47 PMcrossinline suspend
functional parameters. Fixed in Kotlin 1.5.30-RC.
Is it a known bug that either {}
does not work properly with value
classes? For example, the following code:
@JvmInline
value class Metadata(val map: Map<String, String>)
fun reproduceBug() = either<Unit, Metadata>{
Metadata(emptyMap())
}
Whenever I use debug to see the result of the function, it will contain a Right({})
, meaning that the right value actually contains the underlying Map
instead of the Metadata
wrapper. This causes a ClassCastException
in runtime when using bind
. Am I missing something?simon.vergauwen
08/16/2021, 11:51 AMvalue class
doesn’t exist at runtime. IIRC this bug is related to suspend
+ value class
and is “unrelated” to the encoding inside either { }
.
For this reason I’m currently not using value class
yet in production (😞). So this is fixed in 1.5.30?Dario Valdespino
08/16/2021, 12:33 PMsimon.vergauwen
08/16/2021, 12:42 PM