[FIR] Fix UNRESOLVED_REFERENCE in callable reference to delegated var

#KT-57204 Fixed
This commit is contained in:
Kirill Rakhman
2023-03-10 18:53:01 +01:00
committed by Space Team
parent d20ad67aa9
commit 471ecf62c8
6 changed files with 46 additions and 1 deletions
@@ -3859,6 +3859,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/callableReference/property/memberFromTopLevel.kt");
}
@Test
@TestMetadata("mutablePropertyViaDelegation.kt")
public void testMutablePropertyViaDelegation() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/property/mutablePropertyViaDelegation.kt");
}
@Test
@TestMetadata("propertyFromAbstractSuperClass.kt")
public void testPropertyFromAbstractSuperClass() throws Exception {
@@ -3865,6 +3865,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/callableReference/property/memberFromTopLevel.kt");
}
@Test
@TestMetadata("mutablePropertyViaDelegation.kt")
public void testMutablePropertyViaDelegation() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/property/mutablePropertyViaDelegation.kt");
}
@Test
@TestMetadata("propertyFromAbstractSuperClass.kt")
public void testPropertyFromAbstractSuperClass() throws Exception {
@@ -443,7 +443,7 @@ private fun createKPropertyType(
private fun FirVariable.canBeMutableReference(candidate: Candidate): Boolean {
if (!isVar) return false
if (this is FirField) return true
val original = this.unwrapFakeOverrides()
val original = this.unwrapFakeOverridesOrDelegated()
return original.source?.kind == KtFakeSourceElementKind.PropertyFromParameter ||
(original.setter is FirMemberDeclaration &&
candidate.callInfo.session.visibilityChecker.isVisible(original.setter!!, candidate))