Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/exactAnnotationWithUpperBoundConstraint.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

18 lines
640 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_PARAMETER -DEBUG_INFO_CONSTANT -UNUSED_EXPRESSION
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
fun <@kotlin.internal.OnlyInputTypes K, V, V1 : V?>
Map<out K, @kotlin.internal.Exact V>.getOrDefault_Exact(key: K, defaultValue: V1): V1 = TODO()
fun test() {
val map: Map<String, Int> = mapOf("x" to 1)
val r1 = map.getOrDefault_Exact("y", null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>r1<!>
val r2 = map.getOrDefault_Exact("y", null as Int?)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>r2<!>
map.getOrDefault_Exact("y", <!TYPE_MISMATCH, TYPE_MISMATCH!>"string"<!>)
}