dimanche 19 juillet 2020

Generic Top Level Function Reference

How can i reference the following function

@SinceKotlin("1.3")
public fun <T> sequence(@BuilderInference block: suspend SequenceScope<T>.() -> Unit): Sequence<T> = Sequence { iterator(block) }

Attempting

val sequenceFunction: KFunction<Sequence<Int>> = ::sequence

results in a compile-time error

Type inference failed: Not enough information to infer parameter T in fun sequence(block: suspend SequenceScope.() -> Unit): Sequence Please specify it explicitly.





Aucun commentaire:

Enregistrer un commentaire