[FIR] Fix access to fields from super class
^KT-49654 Fixed
This commit is contained in:
committed by
TeamCityServer
parent
e7c9d76163
commit
2aa027639c
+6
@@ -4007,6 +4007,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/visibility/singletonConstructors.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superAccessToJavaField.kt")
|
||||
public void testSuperAccessToJavaField() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/visibility/superAccessToJavaField.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("visibilityWithOverrides.kt")
|
||||
public void testVisibilityWithOverrides() throws Exception {
|
||||
|
||||
+5
@@ -3589,6 +3589,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/visibility/singletonConstructors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("superAccessToJavaField.kt")
|
||||
public void testSuperAccessToJavaField() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/visibility/superAccessToJavaField.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("visibilityWithOverrides.kt")
|
||||
public void testVisibilityWithOverrides() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/visibility/visibilityWithOverrides.kt");
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
FILE: main.kt
|
||||
public abstract interface MyBase : R|Base| {
|
||||
}
|
||||
public abstract class Implementation : R|Derived|, R|MyBase| {
|
||||
public constructor(): R|Implementation| {
|
||||
super<R|Derived|>()
|
||||
}
|
||||
|
||||
public final val parentNode: R|kotlin/String?|
|
||||
public get(): R|kotlin/String?| {
|
||||
^ this@R|/Implementation|.super<R|Derived|>.R|/Derived.parent|
|
||||
}
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// ISSUE: KT-49654
|
||||
// FULL_JDK
|
||||
|
||||
// FILE: Base.java
|
||||
public interface Base {
|
||||
String getParent();
|
||||
}
|
||||
|
||||
// FILE: Derived.java
|
||||
public class Derived implements Base {
|
||||
protected String parent = "";
|
||||
|
||||
public String getParent() {
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
interface MyBase : Base
|
||||
|
||||
abstract class Implementation : Derived(), MyBase {
|
||||
val parentNode: String? get() = super.parent
|
||||
}
|
||||
+6
@@ -4007,6 +4007,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/visibility/singletonConstructors.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superAccessToJavaField.kt")
|
||||
public void testSuperAccessToJavaField() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/visibility/superAccessToJavaField.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("visibilityWithOverrides.kt")
|
||||
public void testVisibilityWithOverrides() throws Exception {
|
||||
|
||||
+6
@@ -4007,6 +4007,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/visibility/singletonConstructors.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superAccessToJavaField.kt")
|
||||
public void testSuperAccessToJavaField() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/visibility/superAccessToJavaField.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("visibilityWithOverrides.kt")
|
||||
public void testVisibilityWithOverrides() throws Exception {
|
||||
|
||||
@@ -8,7 +8,7 @@ package org.jetbrains.kotlin.fir.resolve.calls
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.FirProperty
|
||||
import org.jetbrains.kotlin.fir.declarations.FirVariable
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.modality
|
||||
import org.jetbrains.kotlin.fir.dispatchReceiverClassOrNull
|
||||
import org.jetbrains.kotlin.fir.expressions.FirFunctionCall
|
||||
@@ -134,7 +134,7 @@ private fun BodyResolveComponents.getFunctionMembers(type: ConeKotlinType, name:
|
||||
private fun BodyResolveComponents.getPropertyMembers(type: ConeKotlinType, name: Name): Collection<FirCallableDeclaration> =
|
||||
buildList {
|
||||
type.scope(session, scopeSession, FakeOverrideTypeCalculator.DoNothing)?.processPropertiesByName(name) {
|
||||
addIfNotNull(it.fir as? FirProperty)
|
||||
addIfNotNull(it.fir as? FirVariable)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user