Would it be possible for an interface to have access to properties/functions that will be available upon implementation.
Example.
interface Test<E> where E : Enum<E>, E : Test<E>
This interface would only be able to be implemented by an enum due to its type restrictions. However, you don’t get access to properties and functions of Enum.
Workaround
Currently you can just declare the properties/functions in your interface, and when you implement the interface, they will already be implemented by your class.
ex.
interface Test<E> where E : Enum<E>, E : Test<E> {
val ordinal : Int
fun output() {
println("Ordinal is $ordinal")
}
}
enum class Things : Test<Things> {
ORDINAL_1,
ORDINAL_2
}
But honestly, that would be messy for something more complex. I’m not entirely sure if this is something you can already do, and it would be a great addition if possible.