Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/severalSmartCastsOnReified.kt
T
Dmitry Savvinov b8447d6d97 Add test on smartcasts with reified types
This test introduces very special (for current implementation) case,
when we have smartcast indirectly, via some reified type parameter.

It covers recursive call inSmartCastManager.checkAndRecordPossibleCast(),
which wasn't previously covered by any test in testbase.
2017-11-23 12:45:10 +03:00

11 lines
226 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_PARAMETER
inline fun <reified T : CharSequence?> foo(y: Any?) {
if (y is T?) {
if (y != null) {
bar(<!DEBUG_INFO_SMARTCAST!>y<!>)
}
}
}
fun bar(x: CharSequence) {}