// FIR_IDENTICAL // WITH_STDLIB // LANGUAGE: +NoBuilderInferenceWithoutAnnotationRestriction // SKIP_TXT fun List.myExt() {} fun List.myGenericExt() {} fun a(first: R, second: (List) -> Unit) {} fun test1() { a( buildList { add("") }, second = { it.myGenericExt() } ) } fun b(first: () -> List, second: (List) -> Unit) {} fun test2() { b( first = { buildList { add("") } }, second = { it.myExt() // Note: must be extension to add constraints } ) } fun select(a: Q, b: Q): Q = a // Note: no builder inference annotation fun myBuildList(builder: MutableList.() -> Unit): List { val list = mutableListOf() list.builder() return list } fun test3() { select( buildList { add("") }, buildList { add(1) } ) select ( myBuildList { add("") }, myBuildList { add(1) }, ) select ( run { myBuildList { add("") } }, myBuildList { add(1) }, ) } fun buildPartList(left: MutableList.() -> Unit, right: MutableList.() -> Unit): List { val list = mutableListOf() list.left() list.right() return list } fun test4() { buildPartList( left = { add(1) }, right = { add("") } ) }