Fixed the call completer

to update the type of the argument expression correctly
This commit is contained in:
Svetlana Isakova
2015-10-21 14:42:39 +03:00
parent 06e90cf6a1
commit 9877fe1a26
4 changed files with 30 additions and 4 deletions
@@ -0,0 +1,19 @@
interface PsiElement {
fun <T: PsiElement> findChildByType(i: Int): T? =
if (i == 42) JetOperationReferenceExpression() as T else throw Exception()
}
interface JetSimpleNameExpression : PsiElement {
fun getReferencedNameElement(): PsiElement
}
class JetOperationReferenceExpression : JetSimpleNameExpression {
override fun getReferencedNameElement() = this
}
class JetLabelReferenceExpression : JetSimpleNameExpression {
public override fun getReferencedNameElement(): PsiElement =
findChildByType(42) ?: this
}
fun box(): String {
val element = JetLabelReferenceExpression().getReferencedNameElement()
return if (element is JetOperationReferenceExpression) "OK" else "fail"
}