spxbhuhb / z2-pre

Libraries for Kotlin Multiplatform development
Apache License 2.0
1 stars 0 forks source link

The compiler plugin fails if there is an existing companion object for a schematic without the companion interface #7

Closed toth-istvan-zoltan closed 6 months ago

toth-istvan-zoltan commented 6 months ago

This works, but if I remove the SchematicCompanion supertype, the compilation fails. The problem is that the compiler plugin does not handle properly the existing companion (it should add the supertype in FIR).

The current workaround is to add the companion supertype manually.

class Session : Schematic<Session>() {

    var uuid by uuid<ServiceContext>()
    var securityCode by string()
    val createdAt by instant()
    var vmCreatedAt by long()
    var lastActivity by long()
    var principal by uuid<Principal>().nullable()
    var roles by uuidList<Role>()

    companion object : SchematicCompanion<Session> {
        val SESSION_TOKEN_UUID = UUID<Session>("7fdd494f-e542-4d5b-870b-7cab83dc3197")
        val LOGOUT_TOKEN_UUID = UUID<Session>("61e974dc-094b-42e8-b21c-08502be7c595")
    }
}
toth-istvan-zoltan commented 6 months ago

Fixed