FIR Java/JVM: avoid plain "Array" comparison
This commit is contained in:
committed by
Denis.Zharkov
parent
383de7a9c5
commit
8c7b23a8dd
@@ -39,7 +39,7 @@ class JavaOverrideChecker internal constructor(
|
|||||||
val candidateTypeClassId = candidateType.fullyExpandedType(session).lookupTag.classId.let { it.readOnlyToMutable() ?: it }
|
val candidateTypeClassId = candidateType.fullyExpandedType(session).lookupTag.classId.let { it.readOnlyToMutable() ?: it }
|
||||||
val baseTypeClassId = baseType.fullyExpandedType(session).lookupTag.classId.let { it.readOnlyToMutable() ?: it }
|
val baseTypeClassId = baseType.fullyExpandedType(session).lookupTag.classId.let { it.readOnlyToMutable() ?: it }
|
||||||
if (candidateTypeClassId != baseTypeClassId) return false
|
if (candidateTypeClassId != baseTypeClassId) return false
|
||||||
if (!candidateTypeClassId.shortClassName.isSpecial && candidateTypeClassId.shortClassName.identifier == "Array") {
|
if (candidateTypeClassId == StandardClassIds.Array) {
|
||||||
assert(candidateType.typeArguments.size == 1) {
|
assert(candidateType.typeArguments.size == 1) {
|
||||||
"Array type with unexpected number of type arguments: $candidateType"
|
"Array type with unexpected number of type arguments: $candidateType"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.scopes.jvm
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirFunction
|
import org.jetbrains.kotlin.fir.declarations.FirFunction
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction
|
import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.StandardClassIds
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
import org.jetbrains.kotlin.fir.types.impl.FirImplicitAnyTypeRef
|
import org.jetbrains.kotlin.fir.types.impl.FirImplicitAnyTypeRef
|
||||||
import org.jetbrains.kotlin.fir.types.impl.FirImplicitNullableAnyTypeRef
|
import org.jetbrains.kotlin.fir.types.impl.FirImplicitNullableAnyTypeRef
|
||||||
@@ -101,8 +102,7 @@ private fun StringBuilder.appendConeType(coneType: ConeKotlinType) {
|
|||||||
|
|
||||||
fun appendClassLikeType(type: ConeClassLikeType) {
|
fun appendClassLikeType(type: ConeClassLikeType) {
|
||||||
val classId = type.lookupTag.classId
|
val classId = type.lookupTag.classId
|
||||||
if (classId.shortClassName.isSpecial) return
|
if (classId == StandardClassIds.Array) {
|
||||||
if (classId.shortClassName.identifier == "Array") {
|
|
||||||
append("[")
|
append("[")
|
||||||
type.typeArguments.forEach { typeArg ->
|
type.typeArguments.forEach { typeArg ->
|
||||||
when (typeArg) {
|
when (typeArg) {
|
||||||
|
|||||||
Reference in New Issue
Block a user