Skip to content

Commit

Permalink
Use callElement instead of reportOn in BuilderInferenceAssignmentChecker
Browse files Browse the repository at this point in the history
This commit fixes the breach in reportOn usage
Related to KT-54004

(cherry picked from commit 87af855)
  • Loading branch information
mglukhikh authored and qodana-bot committed Oct 27, 2022
1 parent 5ae6d7e commit bc0aecc
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ object BuilderInferenceAssignmentChecker : CallChecker {
if (resultingDescriptor !is PropertyDescriptor) return
if (context.languageVersionSettings.supportsFeature(LanguageFeature.NoBuilderInferenceWithoutAnnotationRestriction)) return
if (resolvedCall.candidateDescriptor.returnType !is StubTypeForBuilderInference) return
if (reportOn !is KtNameReferenceExpression) return
val binaryExpression = reportOn.getParentOfType<KtBinaryExpression>(strict = true) ?: return
if (!BasicExpressionTypingVisitor.isLValue(reportOn, binaryExpression)) return
val callElement = resolvedCall.call.callElement
if (callElement !is KtNameReferenceExpression) return
val binaryExpression = callElement.getParentOfType<KtBinaryExpression>(strict = true) ?: return
if (!BasicExpressionTypingVisitor.isLValue(callElement, binaryExpression)) return

val leftType = resultingDescriptor.returnType?.takeIf { !it.isError } ?: return
val right = binaryExpression.right ?: return
Expand Down

0 comments on commit bc0aecc

Please sign in to comment.