Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/varnotnull/plusplusMinusminus.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

22 lines
605 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
fun foo(arg: Int?): Int {
var i = arg
if (i != null && <!DEBUG_INFO_SMARTCAST!>i<!>++ == 5) {
return <!DEBUG_INFO_SMARTCAST!><!DEBUG_INFO_SMARTCAST!>i<!>--<!> + <!DEBUG_INFO_SMARTCAST!>i<!>
}
return 0
}
operator fun Long?.inc() = this?.let { it + 1 }
fun bar(arg: Long?): Long {
var i = arg
if (i++ == 5L) {
return i<!UNSAFE_CALL!>--<!> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE{OI}, DEBUG_INFO_MISSING_UNRESOLVED{NI}!>+<!> i
}
if (i++ == 7L) {
return i++ <!UNSAFE_OPERATOR_CALL!>+<!> <!TYPE_MISMATCH!>i<!>
}
return 0L
}