elect
09/30/2021, 3:32 PMinterface Action {
// interface DSL Builder
operator fun<T> invoke(block: T.() -> Unit)
}
Because I cant seem to properly override in the implementation..Ruckus
09/30/2021, 4:06 PMclass ActionImpl : Action {
override fun <T> String.invoke(block: T.() -> Unit) {
// Do something
}
}
Just a standard implementation, unless I misunderstood your question.elect
09/30/2021, 4:49 PMobject V2 : Action {
operator fun invoke(block: Builder.() -> Unit) {..}
class Builder
I get on object V2
Object 'V2' is not abstract and does not implement abstract member public abstract operator fun <T> invoke(block: T.() → Unit): Unit defined in kyge.Actionwhile on the function itself:
Accidental override: The following declarations have the same JVM signature (invoke(Lkotlin/jvm/functions/Function1;)V):
public abstract fun <T> invoke(block: T.() → Unit): Unit defined in kyge.actions.checkout.V2
public final operator fun invoke(block: checkout.V2.Builder.() → Unit): Unit defined in kyge.actions.checkout.V2Ps: it isn't an extension function anymore
Ruckus
09/30/2021, 5:06 PMAction
, not invoke
.
interface Action<T> {
// interface DSL Builder
operator fun invoke(block: T.() -> Unit)
}
object V2 : Action<Builder> {
override fun String.invoke(block: Builder.() -> Unit) {
// Do something
}
class Builder
}
Otherwise invoke
needs to be able to handle any generic valueelect
09/30/2021, 5:17 PMinvoke
function inside the Action
interface, but I don't know how I can call block
from that..
I'm thinking what the best design could beval t: T
in the interface?Ruckus
09/30/2021, 9:09 PMelect
10/01/2021, 5:32 AMAction<T>
interface would initialize the yaml writing