FIR: Fix ambiguity on Int2IntMap in IC

This commit is contained in:
Denis.Zharkov
2021-08-12 15:09:21 +03:00
parent 1a5552bef8
commit c3a327e118
9 changed files with 142 additions and 119 deletions
@@ -66,11 +66,23 @@ class JavaOverrideChecker internal constructor(
candidateTypeRef: FirTypeRef,
baseTypeRef: FirTypeRef,
substitutor: ConeSubstitutor
) = isEqualTypes(
candidateTypeRef.toConeKotlinTypeProbablyFlexible(session, javaTypeParameterStack),
baseTypeRef.toConeKotlinTypeProbablyFlexible(session, javaTypeParameterStack),
substitutor
)
): Boolean {
val candidateType = candidateTypeRef.toConeKotlinTypeProbablyFlexible(session, javaTypeParameterStack)
val baseType = baseTypeRef.toConeKotlinTypeProbablyFlexible(session, javaTypeParameterStack)
if (candidateType.isPrimitiveInJava() != baseType.isPrimitiveInJava()) return false
return isEqualTypes(
candidateType,
baseType,
substitutor
)
}
private fun ConeKotlinType.isPrimitiveInJava(): Boolean = with(context) {
// TODO: Support enhanced type like `@NotNull Integer` that are not nullable, but still aren't primitive
!isNullableType() && isPrimitiveOrNullablePrimitive
}
private fun isEqualArrayElementTypeProjections(
candidateTypeProjection: ConeTypeProjection,