Files
kotlin-fork/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/complexInference.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

49 lines
1.7 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)
// first parameter of the functional type of 'x' can only be inferred from a lambda parameter explicit type specification
fun <X, Y> foo(y: Y, x: (X, Y) -> Unit) {}
fun bar(aInstance: A, bInstance: B) {
foo("") {
(a, b): A, c ->
a checkType { _<Int>() }
b checkType { _<String>() }
c checkType { _<String>() }
}
foo(aInstance) {
a: String, (b, c) ->
a checkType { _<String>() }
b checkType { _<Int>() }
c checkType { _<String>() }
}
foo(bInstance) {
(a, b): A, (c, d) ->
a checkType { _<Int>() }
b checkType { _<String>() }
c checkType { _<Double>() }
d checkType { _<Short>() }
}
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER{NI}, TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER{OI}!>foo<!>(bInstance) {
<!CANNOT_INFER_PARAMETER_TYPE!>(a, b)<!>, (c, d) ->
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>a<!> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE{OI}, DEBUG_INFO_MISSING_UNRESOLVED{NI}!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>b<!> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE{OI}, DEBUG_INFO_MISSING_UNRESOLVED{NI}!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String>() }
c checkType { _<Double>() }
d checkType { _<Short>() }
}
foo<A, B>(bInstance) {
(a, b), (c, d) ->
a checkType { _<Int>() }
b checkType { _<String>() }
c checkType { _<Double>() }
d checkType { _<Short>() }
}
}