Files
kotlin-fork/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/simple.kt
T
Dmitriy Novozhilov e6b5cb5216 [TD] Update diagnostics test data due to new test runners
Update includes:
- Changing syntax of `OI/`NI` tags from `<!NI;TAG!>` to `<!TAG{NI}!>`
- Fix some incorrect directives
- Change order of diagnostics in some places
- Remove ignored diagnostics from FIR test data (previously `DIAGNOSTICS` didn't work)
- Update FIR dumps in some places and add `FIR_IDENTICAL` if needed
- Replace all JAVAC_SKIP with SKIP_JAVAC directive
2020-12-16 19:52:25 +03:00

55 lines
1.3 KiB
Kotlin
Vendored

// !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)
fun foo(block: (A) -> Unit) { }
fun foobar(block: (A, B) -> Unit) { }
fun bar() {
foo { (a, b) ->
a checkType { _<Int>() }
b checkType { _<String>() }
}
foo { (a: Int, b: String) ->
a checkType { _<Int>() }
b checkType { _<String>() }
}
foo { (a, b): A ->
a checkType { _<Int>() }
b checkType { _<String>() }
}
foobar { (a, b), c ->
a checkType { _<Int>() }
b checkType { _<String>() }
c checkType { _<B>() }
}
foobar { a, (b, c) ->
a checkType { _<A>() }
b checkType { _<Double>() }
c checkType { _<Short>() }
}
foobar { (a, b), (c, d) ->
a checkType { _<Int>() }
b checkType { _<String>() }
c checkType { _<Double>() }
d checkType { _<Short>() }
}
foo { (<!COMPONENT_FUNCTION_RETURN_TYPE_MISMATCH!>a: String<!>, b) ->
a checkType { _<Int>() }
b checkType { _<String>() }
}
foo <!TYPE_MISMATCH{NI}!>{ <!EXPECTED_PARAMETER_TYPE_MISMATCH!>(a, b): B<!> ->
a checkType { _<Double>() }
b checkType { _<Short>() }
}<!>
}