[FE 1.0] Use original receivers for NI while DSL scope violation checking

Original receivers are already use in the near place

^KT-46969 Fixed
This commit is contained in:
Victor Petukhov
2022-07-27 20:16:02 +02:00
committed by teamcity
parent eee35af7f9
commit a61648651b
7 changed files with 72 additions and 1 deletions
@@ -47,11 +47,12 @@ object DslScopeViolationCallChecker : CallChecker {
reportOn: PsiElement,
context: CallCheckerContext
) {
val isNewInferenceEnabled = context.languageVersionSettings.supportsFeature(LanguageFeature.NewInference)
val receiversUntilOneFromTheCall =
context.scope.parentsWithSelf
.filterIsInstance<LexicalScope>()
.flatMap { listOfNotNull(it.implicitReceiver) + it.contextReceiversGroup }
.map { it.value }
.map { if (isNewInferenceEnabled) it.value.original else it.value }
.takeWhile { it != callImplicitReceiver }.toList()
if (receiversUntilOneFromTheCall.isEmpty()) return