So many seemingly arbitrary restrictions: `Contra...
# getting-started
d
So many seemingly arbitrary restrictions:
Contracts are not allowed for operator functions
Copy code
@OptIn(ExperimentalContracts::class)
inline operator fun invoke(init: Companion.()->VkAccelerationStructureBuildTypeKHR): VkAccelerationStructureBuildTypeKHR {
    contract { callsInPlace(init, InvocationKind.EXACTLY_ONCE) }
    return this.init()
}
Strangely enough, they are supported in constructors, which works for my use case. 🤷
Oops, never mind. secondary constructors can't be inline, so the contract is meaningless.
d
Yep, found and voted for 😉
Sounds like its not going to be addressed for a while yet though.
Fortunately for me, it isn't a big deal for my use-case to not have a contract on this particular method.