[FIR] Don't resolve call in annotation arguments phase if receiver type isn't resolved
This prevents exceptions from being thrown during resolution of red code because FirExpression.resolvedType is called but during annotation arguments phase we don't have return types for implicitly typed declarations. #KT-61367
This commit is contained in:
committed by
Space Team
parent
66b911c923
commit
462687ed66
@@ -247,6 +247,16 @@ class FirCallResolver(
|
||||
|
||||
@Suppress("NAME_SHADOWING")
|
||||
val qualifiedAccess = qualifiedAccess.let(transformer::transformExplicitReceiver)
|
||||
|
||||
// In red code, annotations can call arbitrary non-const declarations.
|
||||
// During annotation arguments phase, we exit out if the receiver has unresolved type so that we don't throw exceptions.
|
||||
// During body resolve, we will report something like ANNOTATION_ARGUMENT_MUST_BE_CONST.
|
||||
if (transformer.baseTransformerPhase == FirResolvePhase.ARGUMENTS_OF_ANNOTATIONS &&
|
||||
qualifiedAccess.explicitReceiver?.isResolved == false
|
||||
) {
|
||||
return qualifiedAccess
|
||||
}
|
||||
|
||||
val nonFatalDiagnosticFromExpression = (qualifiedAccess as? FirPropertyAccessExpression)?.nonFatalDiagnostics
|
||||
|
||||
val basicResult by lazy(LazyThreadSafetyMode.NONE) {
|
||||
|
||||
Reference in New Issue
Block a user