FIR tower resolve: make static members accessible from derived classes
This commit is contained in:
+1
-1
@@ -91,7 +91,7 @@ class JavaClassUseSiteMemberScope(
|
||||
return superTypesScope.processPropertiesByName(propertyName) {
|
||||
val firCallableMember = it.fir as? FirCallableMemberDeclaration<*>
|
||||
if (firCallableMember?.isStatic == true) {
|
||||
NEXT
|
||||
processor(it)
|
||||
} else {
|
||||
val overriddenBy = it.getOverridden(overrideCandidates)
|
||||
if (overriddenBy == null && it is FirVariableSymbol<*>) {
|
||||
|
||||
@@ -221,15 +221,24 @@ class QualifiedReceiverTowerLevel(
|
||||
processor: TowerScopeLevel.TowerScopeLevelProcessor<T>
|
||||
): ProcessorAction {
|
||||
val qualifiedReceiver = explicitReceiver?.explicitReceiverExpression as FirResolvedQualifier
|
||||
val scope = FirExplicitSimpleImportingScope(
|
||||
listOf(
|
||||
FirResolvedImportImpl(
|
||||
FirImportImpl(null, FqName.topLevel(name), false, null),
|
||||
qualifiedReceiver.packageFqName,
|
||||
qualifiedReceiver.relativeClassFqName
|
||||
val classId = qualifiedReceiver.classId
|
||||
val scope = when {
|
||||
token == TowerScopeLevel.Token.Objects || classId == null -> {
|
||||
FirExplicitSimpleImportingScope(
|
||||
listOf(
|
||||
FirResolvedImportImpl(
|
||||
FirImportImpl(null, FqName.topLevel(name), false, null),
|
||||
qualifiedReceiver.packageFqName,
|
||||
qualifiedReceiver.relativeClassFqName
|
||||
)
|
||||
), session, bodyResolveComponents.scopeSession
|
||||
)
|
||||
), session, bodyResolveComponents.scopeSession
|
||||
)
|
||||
}
|
||||
else -> {
|
||||
session.firSymbolProvider.getClassUseSiteMemberScope(classId, session, bodyResolveComponents.scopeSession)
|
||||
?: return ProcessorAction.NEXT
|
||||
}
|
||||
}
|
||||
|
||||
val processorForCallables: (FirCallableSymbol<*>) -> ProcessorAction = {
|
||||
val fir = it.fir
|
||||
|
||||
+3
-3
@@ -5,8 +5,8 @@
|
||||
// FILE: CommonDataKeys.java
|
||||
|
||||
public class CommonDataKeys {
|
||||
public static final String PROJECT = "project";
|
||||
public final String MEMBER = "member"
|
||||
public static final String PROJECT = "project";
|
||||
public final String MEMBER = "member"
|
||||
}
|
||||
|
||||
// FILE: PlatformDataKeys.java
|
||||
@@ -18,6 +18,6 @@ public class PlatformDataKeys extends CommonDataKeys {
|
||||
// FILE: main.kt
|
||||
|
||||
fun test() {
|
||||
val project = PlatformDataKeys.<!UNRESOLVED_REFERENCE!>PROJECT<!>
|
||||
val project = PlatformDataKeys.PROJECT
|
||||
val member = PlatformDataKeys().MEMBER
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
FILE: main.kt
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval project: <ERROR TYPE REF: Unresolved name: PROJECT> = Q|PlatformDataKeys|.<Unresolved name: PROJECT>#
|
||||
lval project: R|ft<kotlin/String, kotlin/String?>!| = Q|PlatformDataKeys|.R|/CommonDataKeys.PROJECT|
|
||||
lval member: R|ft<kotlin/String, kotlin/String?>!| = R|/PlatformDataKeys.PlatformDataKeys|().R|/CommonDataKeys.MEMBER|
|
||||
}
|
||||
-5
@@ -858,11 +858,6 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
|
||||
runTest("compiler/fir/resolve/testData/resolve/problems/propertyFromJavaPlusAssign.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("superTypeStaticScope.kt")
|
||||
public void testSuperTypeStaticScope() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolve/problems/superTypeStaticScope.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("syntheticsVsNormalProperties.kt")
|
||||
public void testSyntheticsVsNormalProperties() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolve/problems/syntheticsVsNormalProperties.kt");
|
||||
|
||||
Generated
+5
@@ -466,6 +466,11 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
|
||||
runTest("compiler/fir/resolve/testData/resolve/stdlib/j+k/RawType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("StaticFromBaseClass.kt")
|
||||
public void testStaticFromBaseClass() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolve/stdlib/j+k/StaticFromBaseClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("StaticGenericMethod.kt")
|
||||
public void testStaticGenericMethod() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolve/stdlib/j+k/StaticGenericMethod.kt");
|
||||
|
||||
Reference in New Issue
Block a user