[FIR] Report INNER_CLASS_CONSTRUCTOR_NO_RECEIVER on delegated constructor calls
#KT-59677 Fixed
This commit is contained in:
committed by
Space Team
parent
a13756cfe9
commit
72235b8527
+12
-2
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.fir.resolve.calls.*
|
||||
import org.jetbrains.kotlin.fir.resolve.delegatingConstructorScope
|
||||
import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag
|
||||
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
||||
import org.jetbrains.kotlin.fir.types.toRegularClassSymbol
|
||||
import org.jetbrains.kotlin.fir.types.typeContext
|
||||
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind
|
||||
import org.jetbrains.kotlin.types.AbstractTypeChecker
|
||||
@@ -103,7 +104,7 @@ class FirTowerResolver(
|
||||
if (outerType != null)
|
||||
components.implicitReceiverStack.receiversAsReversed().drop(1).firstOrNull {
|
||||
AbstractTypeChecker.isSubtypeOf(components.session.typeContext, it.type, outerType)
|
||||
} ?: return collector // TODO: report diagnostic about not-found receiver, KT-59677
|
||||
}
|
||||
else
|
||||
null
|
||||
|
||||
@@ -120,7 +121,16 @@ class FirTowerResolver(
|
||||
scope,
|
||||
dispatchReceiver?.receiverExpression,
|
||||
givenExtensionReceiverOptions = emptyList()
|
||||
),
|
||||
).apply {
|
||||
if (outerType != null && dispatchReceiver == null) {
|
||||
val diagnostic = constructedType
|
||||
.toRegularClassSymbol(context.session)
|
||||
?.let(::MissingInnerClassConstructorReceiver)
|
||||
?: InapplicableCandidate
|
||||
|
||||
addDiagnostic(diagnostic)
|
||||
}
|
||||
},
|
||||
context
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user