[FE1.0] Fix false reporting of non-matching annotations in IDE...
...when typealiased expect class used in class literal. ^KTIJ-26700 Fixed
This commit is contained in:
committed by
Space Team
parent
3124cbcbad
commit
6b217369a8
+11
-7
@@ -389,13 +389,17 @@ class ClassicExpectActualMatchingContext(
|
||||
return classDescriptor
|
||||
}
|
||||
val classId = classDescriptor.classId
|
||||
// For IDE composite module analysis, when actual annotation may differ
|
||||
val platformDescriptor = platformModule.findClassifierAcrossModuleDependencies(classId)
|
||||
return when (platformDescriptor) {
|
||||
is ClassDescriptor -> platformDescriptor
|
||||
is TypeAliasDescriptor -> platformDescriptor.classDescriptor ?: classDescriptor
|
||||
else -> classDescriptor
|
||||
}
|
||||
return findExpandedExpectClassInPlatformModule(classId) ?: classDescriptor
|
||||
}
|
||||
}
|
||||
|
||||
// For IDE composite module analysis, when actual class may differ
|
||||
internal fun findExpandedExpectClassInPlatformModule(originalClassId: ClassId): ClassDescriptor? {
|
||||
val classifier = platformModule.findClassifierAcrossModuleDependencies(originalClassId)
|
||||
return when (classifier) {
|
||||
is TypeAliasDescriptor -> classifier.classDescriptor
|
||||
is ClassDescriptor -> classifier
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-2
@@ -7,10 +7,10 @@ package org.jetbrains.kotlin.resolve.multiplatform
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.resolve.calls.mpp.ExpectActualCollectionArgumentsCompatibilityCheckStrategy
|
||||
import org.jetbrains.kotlin.resolve.calls.mpp.ExpectActualMatchingContext
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue
|
||||
import org.jetbrains.kotlin.resolve.constants.KClassValue
|
||||
|
||||
internal fun ExpectActualMatchingContext<*>.areExpressionConstValuesEqual(
|
||||
internal fun ClassicExpectActualMatchingContext.areExpressionConstValuesEqual(
|
||||
expectValue: Any?,
|
||||
actualValue: Any?,
|
||||
collectionArgumentsCompatibilityCheckStrategy: ExpectActualCollectionArgumentsCompatibilityCheckStrategy,
|
||||
@@ -36,6 +36,16 @@ internal fun ExpectActualMatchingContext<*>.areExpressionConstValuesEqual(
|
||||
areExpressionConstValuesEqual(f, s, collectionArgumentsCompatibilityCheckStrategy)
|
||||
}
|
||||
}
|
||||
expectValue is KClassValue.Value.NormalClass && actualValue is KClassValue.Value.NormalClass -> {
|
||||
val expectClassIdOriginal = expectValue.classId
|
||||
val expectClassIdPlatform = findExpandedExpectClassInPlatformModule(expectClassIdOriginal)?.classId
|
||||
val expectValueCopy = expectValue.copy(
|
||||
value = expectValue.value.copy(
|
||||
classId = expectClassIdPlatform ?: expectClassIdOriginal
|
||||
)
|
||||
)
|
||||
expectValueCopy == actualValue
|
||||
}
|
||||
else -> expectValue == actualValue
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user