Open Octogonapus opened 5 years ago
A data class which contains a member which is a typealias causes the generated code to be invalid.
typealias
This code:
typealias Foo = Either<String, Int> @json data class DataClass1( val foo: Foo ) { companion object }
Generates this:
fun DataClass1.toJson(): Json = JsObject(mapOf( "foo" to com.octogonapus.heliosdemo.Foo.encoder().run { foo.encode() } ))
foo.encode() is an unresolved reference.
foo.encode()
Changing the data class to:
@json data class DataClass1( val foo: Either<String, Int> ) { companion object }
Generates this, which compiles fine:
fun DataClass1.toJson(): Json = JsObject(mapOf( "foo" to arrow.core.Either.Companion.encoder(kotlin.String.encoder(), kotlin.Int.encoder()).run { foo.encode() } ))
There is a sample project containing this code here https://github.com/Octogonapus/helios-demo/tree/typealias_issue (specifically on branch typealias_issue).
typealias_issue
A data class which contains a member which is a
typealias
causes the generated code to be invalid.This code:
Generates this:
foo.encode()
is an unresolved reference.Changing the data class to:
Generates this, which compiles fine:
There is a sample project containing this code here https://github.com/Octogonapus/helios-demo/tree/typealias_issue (specifically on branch
typealias_issue
).