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:
@@ -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")
|
||||
Reference in New Issue
Block a user