This message was deleted.
# coroutines
s
This message was deleted.
o
shouldn't this be in #general ? not sure what's coroutine-related about this
k
You can put bounds on the parameters on the extension function:
Copy code
class A<T>(val contents: T)

fun <T : Number> A<T>.foo(): Int = contents.toInt() + 4

val x = A(4).foo()
val y = A("Test").foo()
k
Oof, I though I posted this in general, Is there a way to move a msg?
@Kristoffer Andersen That does only allow you to specify a type parameter for the receiver function, not for the context.