// !WITH_NEW_INFERENCE // !CHECK_TYPE // !DIAGNOSTICS: -UNUSED_PARAMETER data class A(val x: Int, val y: String) data class B(val u: Double, val w: Short) // first parameter of the functional type of 'x' can only be inferred from a lambda parameter explicit type specification fun foo(y: Y, x: (X, Y) -> Unit) {} fun bar(aInstance: A, bInstance: B) { foo("") { (a, b): A, c -> a checkType { _() } b checkType { _() } c checkType { _() } } foo(aInstance) { a: String, (b, c) -> a checkType { _() } b checkType { _() } c checkType { _() } } foo(bInstance) { (a, b): A, (c, d) -> a checkType { _() } b checkType { _() } c checkType { _() } d checkType { _() } } foo(bInstance) { (a, b), (c, d) -> a checkType { _() } b checkType { _() } c checkType { _() } d checkType { _() } } foo(bInstance) { (a, b), (c, d) -> a checkType { _() } b checkType { _() } c checkType { _() } d checkType { _() } } }