Files
kotlin-fork/compiler/testData/codegen/box/fakeOverride/javaInheritsKotlinIntersectionOverride.kt
T
Kirill Rakhman 9ec0210c04 [FIR] Support enhancing intersection overrides
When a type annotated with @PurelyImplements (explicitly or implicitly)
inherited some methods from a java supertype and the purely implemented
Kotlin supertype, it was inconsistent which of the signatures the
intersection override would have (with or without flexible types).
This commit adds support for the enhancement of intersection overrides.
If one of the overridden methods has non-flexible types, the enhanced
method will have non-flexible types.
This fixes some false negative nullability type mismatches.

#KT-59921 Fixed
2024-01-31 11:16:50 +00:00

30 lines
638 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// MODULE: lib
// FILE: KtWhenExpression.java
public class KtWhenExpression extends KtExpressionImpl {}
// FILE: KtExpressionImpl.kt
abstract class KtExpressionImpl : PsiElementBase(), PsiElement {}
// FILE: PsiElementBase.java
public abstract class PsiElementBase implements PsiElement {
@Override
public String getProject() { return ""; }
}
// FILE: PsiElement.java
public interface PsiElement {
String getProject();
}
// MODULE: box(lib)
// FILE: box.kt
private fun test(expression: KtWhenExpression) {
expression.project
}
fun box(): String {
test(KtWhenExpression())
return "OK"
}