[FIR] Fix exception in Java scope caused by inherited member with implicit return type

It's caused by checking the return type of an inherited property.
toConeKotlinTypeProbablyFlexible() returns an error type when the
type ref is unresolved instead of throwing.
This "breaks" some override checks and in the added test, it leads
to an additional candidate being created for a synthetic property.
However, the candidate has applicability K2_SYNTHETIC_RESOLVED
and gets filtered out because the real property has a higher
applicability.

#KT-66392 Fixed
This commit is contained in:
Kirill Rakhman
2024-03-14 15:23:19 +01:00
committed by Space Team
parent 8f420eb3e1
commit 2095f90e69
9 changed files with 69 additions and 6 deletions
@@ -1,7 +1,5 @@
// FIR_IDENTICAL
// ISSUE: KT-66048
// IGNORE_REVERSED_RESOLVE
// ^KT-66392
// FILE: Java1.java
public class Java1 extends KotlinClass {
@@ -0,0 +1,18 @@
// ISSUE: KT-66392
// FILE: Java1.java
public class Java1 extends KotlinClass {
@Override
public String getE() {
return "2";
}
}
// FILE: test.kt
// The order of Kotlin classes is important
class B : Java1() {
override var e = super.e
}
open class KotlinClass {
open var e = "1"
}
@@ -0,0 +1,18 @@
// ISSUE: KT-66392
// FILE: Java1.java
public class Java1 extends KotlinClass {
@Override
public String getE() {
return "2";
}
}
// FILE: test.kt
// The order of Kotlin classes is important
class B : Java1() {
<!ACCIDENTAL_OVERRIDE!>override var e<!> = super.e
}
open class KotlinClass {
open var e = "1"
}