[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:
committed by
Space Team
parent
8f420eb3e1
commit
2095f90e69
+3
-4
@@ -18,6 +18,8 @@ import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertySetter
|
||||
import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty
|
||||
import org.jetbrains.kotlin.fir.declarations.synthetic.buildSyntheticProperty
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.*
|
||||
import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic
|
||||
import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind
|
||||
import org.jetbrains.kotlin.fir.java.SyntheticPropertiesCacheKey
|
||||
import org.jetbrains.kotlin.fir.java.declarations.FirJavaClass
|
||||
import org.jetbrains.kotlin.fir.java.declarations.FirJavaMethod
|
||||
@@ -890,10 +892,7 @@ class JavaClassUseSiteMemberScope(
|
||||
}
|
||||
|
||||
private fun FirTypeRef.probablyJavaTypeRefToConeType(): ConeKotlinType {
|
||||
return when (this) {
|
||||
is FirJavaTypeRef -> toConeKotlinTypeProbablyFlexible(session, typeParameterStack)
|
||||
else -> coneType
|
||||
}
|
||||
return toConeKotlinTypeProbablyFlexible(session, typeParameterStack)
|
||||
}
|
||||
|
||||
// It's either overrides Collection.contains(Object) or Collection.containsAll(Collection<?>) or similar methods
|
||||
|
||||
Reference in New Issue
Block a user