我有这个函数(理论上)接受一个函数数组作为参数。
fun execute(afterDay: Long, listeners: Array<(List<String>) -> Unit>)
在客户端类中,我尝试调用此执行方法并将函数作为参数传递:
fun updateMovies(ids: Array<String>){
}
fun getNewIds() {
GetImdbIds(kodein).execute(daysBack.toEpochDay(), [::updateMovies])
}
但它不编译。
我做错了什么?
错误:
Error:(29, 59) Kotlin: Type inference failed. Expected type mismatch: inferred type is Array<KFunction1<@ParameterName Array<String>, Unit>> but Array<(List<String>) -> Unit> was expected
Error:(29, 59) Kotlin: Unsupported [Collection literals outside of annotations]