Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/varInInitNoPrimary.kt
T
Mikhail Glukhikh 56e633e345 CFA: detect captured writes more precisely
So #KT-14381 Fixed
So #KT-13597 Fixed
Also refactors captured writes detection inside DFA
2017-05-02 19:59:23 +03:00

22 lines
524 B
Kotlin
Vendored

class Your {
init {
var y: String? = "xyz"
if (y != null) {
// Bug that should be fixed
// Problem: descriptorToDeclaration cannot get here init block by its descriptor
// See PreliminaryDeclarationVisitor.getVisitorByVariable
<!SMARTCAST_IMPOSSIBLE!>y<!>.hashCode()
}
}
constructor()
}
class Normal {
init {
var y: String? = "xyz"
if (y != null) {
<!DEBUG_INFO_SMARTCAST!>y<!>.hashCode()
}
}
}