Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letAlwaysChangesToNotNull.kt
T
Dmitry Savvinov b064c48f83 Fix testdata after advancing LATEST_STABLE to 1.3
This commit contains minor changes in testdata, where test and behavior
change are not related
2018-08-30 16:24:31 +03:00

8 lines
251 B
Kotlin
Vendored

// KT-9051: Allow smart cast for captured variables if they are not modified
fun foo(y: String) {
var x: String? = <!VARIABLE_WITH_REDUNDANT_INITIALIZER!>null<!>
y.let { x = it }
x<!UNSAFE_CALL!>.<!>length // Smart cast is not possible
}