Got a bug report on KotlinPoet regarding the follo...
# announcements
e
Got a bug report on KotlinPoet regarding the following scenario:
Copy code
enum class RenderPassCreate(override val value: Int) {
    companion object
}
This is the code we currently generate, and it will not compile, with the error being
Expecting ';' after the last enum entry or '}' to close enum class body
. The compiler expects the following:
Copy code
enum class RenderPassCreate(override val value: Int) {
    ;
    companion object
}
which in my opinion looks ugly. I wonder if there’s a hard technical limitation behind this, and whether the compiler could handle this better? Tried searching YouTrack and it doesn’t look like it’s been filed
r
How do you expect the compiler to know
companion
isn't one of the enum's values? As a side note, what is the purpose of an enum without values?
💯 1
e
both are good points
d
In vulkan, some enums have no entries yet and are reserved for future use.
r
@Dominaezzz Interesting. That seems... pointless, but that may just be because I've never done any Vulkan development.
d
It's done so they don't have the situation where they have to make a
vkCreateRenderPass2(...)
method because
vkCreateRenderPass(...)
doesn't take a
RenderPassCreate
parameter. It's also consistent with all the other
vkCreateSomeObject
methods that take a
SomeObjectCreate
parameter that have actual entries.
r
So you always pass in null for now? Or can you just not call the function yet?
d
Yeah, always pass null.