Simplify reportOnElement
Relates to #KT-38959
This commit is contained in:
committed by
Space
parent
b385650bf0
commit
3d236b7171
@@ -1330,8 +1330,7 @@ public class DescriptorResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isStaticNestedClass(classDescriptor)) {
|
if (isStaticNestedClass(classDescriptor)) {
|
||||||
PsiElement onReport = (reportErrorsOn instanceof KtConstructorDelegationCall)
|
PsiElement onReport = CallResolverUtilKt.reportOnElement(reportErrorsOn);
|
||||||
? CallResolverUtilKt.reportOnElement((KtConstructorDelegationCall) reportErrorsOn) : reportErrorsOn;
|
|
||||||
trace.report(INACCESSIBLE_OUTER_CLASS_EXPRESSION.on(onReport, classDescriptor));
|
trace.report(INACCESSIBLE_OUTER_CLASS_EXPRESSION.on(onReport, classDescriptor));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -522,8 +522,7 @@ public class CallResolver {
|
|||||||
@Nullable
|
@Nullable
|
||||||
private PsiElement calcReportOn(@NotNull KtConstructorDelegationReferenceExpression calleeExpression) {
|
private PsiElement calcReportOn(@NotNull KtConstructorDelegationReferenceExpression calleeExpression) {
|
||||||
PsiElement delegationCall = calleeExpression.getParent();
|
PsiElement delegationCall = calleeExpression.getParent();
|
||||||
return delegationCall instanceof KtConstructorDelegationCall
|
return CallResolverUtilKt.reportOnElement(delegationCall);
|
||||||
? CallResolverUtilKt.reportOnElement((KtConstructorDelegationCall) delegationCall) : delegationCall;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.resolve.calls.callResolverUtil
|
package org.jetbrains.kotlin.resolve.calls.callResolverUtil
|
||||||
|
|
||||||
import com.google.common.collect.Lists
|
import com.google.common.collect.Lists
|
||||||
|
import com.intellij.psi.PsiElement
|
||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||||
import org.jetbrains.kotlin.builtins.ReflectionTypes
|
import org.jetbrains.kotlin.builtins.ReflectionTypes
|
||||||
import org.jetbrains.kotlin.builtins.isSuspendFunctionType
|
import org.jetbrains.kotlin.builtins.isSuspendFunctionType
|
||||||
@@ -322,6 +323,8 @@ fun createResolutionCandidatesForConstructors(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun KtConstructorDelegationCall.reportOnElement() = if (this.isImplicit) {
|
internal fun PsiElement.reportOnElement() =
|
||||||
this.getStrictParentOfType<KtSecondaryConstructor>()!!
|
(this as? KtConstructorDelegationCall)
|
||||||
} else this
|
?.takeIf { isImplicit }
|
||||||
|
?.let { getStrictParentOfType<KtSecondaryConstructor>()!! }
|
||||||
|
?: this
|
||||||
|
|||||||
Reference in New Issue
Block a user