diff --git a/plugins/kotlin/code-insight/inspections-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/inspections/UsePropertyAccessSyntaxInspection.kt b/plugins/kotlin/code-insight/inspections-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/inspections/UsePropertyAccessSyntaxInspection.kt index aa222a19b363..ee3ef0c3360c 100644 --- a/plugins/kotlin/code-insight/inspections-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/inspections/UsePropertyAccessSyntaxInspection.kt +++ b/plugins/kotlin/code-insight/inspections-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/inspections/UsePropertyAccessSyntaxInspection.kt @@ -117,7 +117,10 @@ class UsePropertyAccessSyntaxInspection : LocalInspectionTool(), CleanupLocalIns val problemHighlightType = getProblemHighlightType(symbolPsi) - val receiverType = callableReferenceExpression.getReceiverKtType()?.lowerBoundIfFlexible() ?: return + val receiverType = + callableReferenceExpression.resolveCall() + ?.successfulFunctionCallOrNull()?.partiallyAppliedSymbol?.dispatchReceiver?.type?.lowerBoundIfFlexible() + ?: callableReferenceExpression.getReceiverKtType()?.lowerBoundIfFlexible() ?: return val syntheticProperty = getSyntheticProperty(propertyNames, receiverType) ?: return diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/usePropertyAccessSyntax/callableReferenceExpressions/replaceCallableReferenceCalledOnConstructor.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/usePropertyAccessSyntax/callableReferenceExpressions/replaceCallableReferenceCalledOnConstructor.kt index 9d6a946fbe43..a7be5a2be929 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/usePropertyAccessSyntax/callableReferenceExpressions/replaceCallableReferenceCalledOnConstructor.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/usePropertyAccessSyntax/callableReferenceExpressions/replaceCallableReferenceCalledOnConstructor.kt @@ -1,8 +1,7 @@ // LANGUAGE_VERSION: 2.1 // COMPILER_ARGUMENTS: -XXLanguage:+ReferencesToSyntheticJavaProperties // FIX: Use property access syntax -// IGNORE_K2 -// Delete the ignore directive after fixing KTIJ-29118 + fun main() { suppressUnused(Foo()::getFoo) } diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/usePropertyAccessSyntax/callableReferenceExpressions/replaceCallableReferenceCalledOnConstructor.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/usePropertyAccessSyntax/callableReferenceExpressions/replaceCallableReferenceCalledOnConstructor.kt.after index b43139f93cbc..d3d9112fb400 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/usePropertyAccessSyntax/callableReferenceExpressions/replaceCallableReferenceCalledOnConstructor.kt.after +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/usePropertyAccessSyntax/callableReferenceExpressions/replaceCallableReferenceCalledOnConstructor.kt.after @@ -1,8 +1,7 @@ // LANGUAGE_VERSION: 2.1 // COMPILER_ARGUMENTS: -XXLanguage:+ReferencesToSyntheticJavaProperties // FIX: Use property access syntax -// IGNORE_K2 -// Delete the ignore directive after fixing KTIJ-29118 + fun main() { suppressUnused(Foo()::foo) }