[LL FIR] LLFirTypeLazyResolver: add missed type checks for context receivers

This commit is contained in:
Dmitrii Gridin
2024-02-19 16:19:21 +01:00
committed by Space Team
parent 7048184acf
commit 410dbcb4cf
2 changed files with 21 additions and 2 deletions
@@ -52,6 +52,9 @@ internal object LLFirTypeLazyResolver : LLFirLazyResolver(FirResolvePhase.TYPES)
checkTypeRefIsResolved(bound, "type parameter bound", target)
}
}
is FirRegularClass -> checkContextReceiverTypeRefIsResolved(target)
is FirScript -> checkContextReceiverTypeRefIsResolved(target)
}
}
}
@@ -177,9 +177,25 @@ internal fun checkReceiverTypeRefIsResolved(declaration: FirCallableDeclaration,
}
internal fun checkContextReceiverTypeRefIsResolved(declaration: FirCallableDeclaration, acceptImplicitTypeRef: Boolean = false) {
for (contextReceiver in declaration.contextReceivers) {
checkContextReceiverTypeRefIsResolved(declaration.contextReceivers, declaration, acceptImplicitTypeRef)
}
internal fun checkContextReceiverTypeRefIsResolved(declaration: FirRegularClass, acceptImplicitTypeRef: Boolean = false) {
checkContextReceiverTypeRefIsResolved(declaration.contextReceivers, declaration, acceptImplicitTypeRef)
}
internal fun checkContextReceiverTypeRefIsResolved(declaration: FirScript, acceptImplicitTypeRef: Boolean = false) {
checkContextReceiverTypeRefIsResolved(declaration.contextReceivers, declaration, acceptImplicitTypeRef)
}
private fun checkContextReceiverTypeRefIsResolved(
contextReceivers: List<FirContextReceiver>,
owner: FirDeclaration,
acceptImplicitTypeRef: Boolean,
) {
for (contextReceiver in contextReceivers) {
val receiverTypeRef = contextReceiver.typeRef
checkTypeRefIsResolved(receiverTypeRef, typeRefName = "context receiver type", declaration, acceptImplicitTypeRef)
checkTypeRefIsResolved(receiverTypeRef, typeRefName = "context receiver type", owner, acceptImplicitTypeRef)
}
}