Files
kotlin-fork/compiler/testData/codegen/box/elvis/kt6694ExactAnnotationForElvis.kt
T
Steven Schäfer aea5e3ffbc JVM IR: Remove type substitutions from ExpressionCodegen
Instead, determine whether the return type of a call is Nothing, by
looking at the type of the call expression.
2020-01-22 15:51:11 +01:00

20 lines
726 B
Kotlin
Vendored

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"
}