FIR [IDE]: provide correct node phase when necessary

This commit is contained in:
Ilya Kirillov
2020-07-30 17:38:11 +03:00
committed by Mikhail Glukhikh
parent 119302b016
commit b1d3ab04c2
4 changed files with 8 additions and 2 deletions
@@ -68,10 +68,14 @@ internal fun FirScope.processFunctionsAndConstructorsByName(
processConstructorsByName( processConstructorsByName(
name, session, bodyResolveComponents, name, session, bodyResolveComponents,
includeInnerConstructors = includeInnerConstructors, includeInnerConstructors = includeInnerConstructors,
processor = processor processor = {
with(bodyResolveComponents) { it.phasedFir }
processor(it)
}
) )
processFunctionsByName(name) { processFunctionsByName(name) {
with(bodyResolveComponents) { it.phasedFir }
processor(it) processor(it)
} }
} }
@@ -15,6 +15,7 @@ import kotlin.coroutines.resume
class ResolutionStageRunner(val components: InferenceComponents) { class ResolutionStageRunner(val components: InferenceComponents) {
fun processCandidate(candidate: Candidate, stopOnFirstError: Boolean = true): CandidateApplicability { fun processCandidate(candidate: Candidate, stopOnFirstError: Boolean = true): CandidateApplicability {
val sink = CheckerSinkImpl(components, stopOnFirstError = stopOnFirstError) val sink = CheckerSinkImpl(components, stopOnFirstError = stopOnFirstError)
with (candidate.bodyResolveComponents) { candidate.symbol.phasedFir }
var finished = false var finished = false
sink.continuation = suspend { sink.continuation = suspend {
candidate.callInfo.callKind.resolutionSequence.forEachIndexed { index, stage -> candidate.callInfo.callKind.resolutionSequence.forEachIndexed { index, stage ->
@@ -183,6 +183,7 @@ private class TowerScopeLevelProcessor(
implicitExtensionReceiverValue: ImplicitReceiverValue<*>?, implicitExtensionReceiverValue: ImplicitReceiverValue<*>?,
builtInExtensionFunctionReceiverValue: ReceiverValue? builtInExtensionFunctionReceiverValue: ReceiverValue?
) { ) {
with(candidateFactory.bodyResolveComponents) { symbol.phasedFir }
// Check explicit extension receiver for default package members // Check explicit extension receiver for default package members
if (symbol is FirNamedFunctionSymbol && dispatchReceiverValue == null && if (symbol is FirNamedFunctionSymbol && dispatchReceiverValue == null &&
(implicitExtensionReceiverValue == null) != (explicitReceiver == null) && (implicitExtensionReceiverValue == null) != (explicitReceiver == null) &&
@@ -87,7 +87,7 @@ class MemberScopeTowerLevel(
if (candidate is FirCallableSymbol<*> && if (candidate is FirCallableSymbol<*> &&
(implicitExtensionInvokeMode || candidate.hasConsistentExtensionReceiver(extensionReceiver)) (implicitExtensionInvokeMode || candidate.hasConsistentExtensionReceiver(extensionReceiver))
) { ) {
val fir = candidate.fir val fir = with(bodyResolveComponents) { candidate.phasedFir }
if ((fir as? FirConstructor)?.isInner == false) { if ((fir as? FirConstructor)?.isInner == false) {
return@processScopeMembers return@processScopeMembers
} }