kotlin icon indicating copy to clipboard operation
kotlin copied to clipboard

Allow parameter annotation for lambda expression

Open anatawa12 opened this issue 4 years ago • 0 comments

fixes KT-17882

Sorry, I couldn't found the best way to implement tests so can you help me or can you add tests for this?

I've tested that

  • dumped IR () has annotations
  • compiled code with kotlinc has annotations for parameters with
fun main(args: Array<String>) {}

typealias Func = (Pair<String, String>) -> Unit;

fun test(@Ann list: List<Pair<String, String>>): (Pair<String, String>) -> Unit {
    val v0: Func = { @Ann test -> }
    //val v1: Func = { @Ann (test1, test2) -> }
    val v2: Func = { (@Ann test1, test2) -> }
    return if (list.isEmpty()) v0 else v2
}

annotation class Ann()

anatawa12 avatar Aug 14 '21 08:08 anatawa12