[FIR] Fix case with lazy resolve in expect-actual annotation checker

Unresolved annotation arguments were treated as absent arguments,
which lead to false-positive reports.
Add assert and test for that and fix.

MR: KT-MR-12245

^KT-60671 Fixed
This commit is contained in:
Roman Efremov
2023-09-20 11:09:51 +02:00
committed by Space Team
parent 4c75fb108f
commit 0fd700de21
10 changed files with 106 additions and 13 deletions
@@ -544,6 +544,8 @@ internal abstract class IrExpectActualMatchingContext(
override fun TypeRefMarker.getClassId(): ClassId? = (this as IrType).getClass()?.classId
override fun checkAnnotationsOnTypeRefAndArguments(
expectContainingSymbol: DeclarationSymbolMarker,
actualContainingSymbol: DeclarationSymbolMarker,
expectTypeRef: TypeRefMarker,
actualTypeRef: TypeRefMarker,
checker: ExpectActualMatchingContext.AnnotationsCheckerCallback
@@ -560,7 +562,7 @@ internal abstract class IrExpectActualMatchingContext(
for ((expectArg, actualArg) in expectTypeRef.arguments.zip(actualTypeRef.arguments)) {
val expectArgType = expectArg.typeOrNull ?: continue
val actualArgType = actualArg.typeOrNull ?: continue
checkAnnotationsOnTypeRefAndArguments(expectArgType, actualArgType, checker)
checkAnnotationsOnTypeRefAndArguments(expectContainingSymbol, actualContainingSymbol, expectArgType, actualArgType, checker)
}
}
}