KT-4009 Unnecessary attempt to do a smart cast causes an error

#KT-4009 Fixed
  do not add smart casted types for vars to constraint system
This commit is contained in:
Svetlana Isakova
2013-09-25 20:43:41 +04:00
parent 9a0ec7949e
commit de85d3df72
3 changed files with 28 additions and 0 deletions
@@ -0,0 +1,21 @@
trait PsiElement {
fun getText(): String
fun getParent(): PsiElement
}
trait JetExpression : PsiElement
fun foo1(e: PsiElement) {
var current: PsiElement? = e
var first = true
while (current != null) {
if (current is JetExpression && first) {
println(current!!.getText()) // error: smart cast not possible. But it's not needed in fact!
}
current = current?.getParent()
}
}
//from library
fun println(any: Any?) = throw Exception("$any")