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) {
|
return superTypesScope.processPropertiesByName(propertyName) {
|
||||||
val firCallableMember = it.fir as? FirCallableMemberDeclaration<*>
|
val firCallableMember = it.fir as? FirCallableMemberDeclaration<*>
|
||||||
if (firCallableMember?.isStatic == true) {
|
if (firCallableMember?.isStatic == true) {
|
||||||
NEXT
|
processor(it)
|
||||||
} else {
|
} else {
|
||||||
val overriddenBy = it.getOverridden(overrideCandidates)
|
val overriddenBy = it.getOverridden(overrideCandidates)
|
||||||
if (overriddenBy == null && it is FirVariableSymbol<*>) {
|
if (overriddenBy == null && it is FirVariableSymbol<*>) {
|
||||||
|
|||||||
@@ -221,15 +221,24 @@ class QualifiedReceiverTowerLevel(
|
|||||||
processor: TowerScopeLevel.TowerScopeLevelProcessor<T>
|
processor: TowerScopeLevel.TowerScopeLevelProcessor<T>
|
||||||
): ProcessorAction {
|
): ProcessorAction {
|
||||||
val qualifiedReceiver = explicitReceiver?.explicitReceiverExpression as FirResolvedQualifier
|
val qualifiedReceiver = explicitReceiver?.explicitReceiverExpression as FirResolvedQualifier
|
||||||
val scope = FirExplicitSimpleImportingScope(
|
val classId = qualifiedReceiver.classId
|
||||||
listOf(
|
val scope = when {
|
||||||
FirResolvedImportImpl(
|
token == TowerScopeLevel.Token.Objects || classId == null -> {
|
||||||
FirImportImpl(null, FqName.topLevel(name), false, null),
|
FirExplicitSimpleImportingScope(
|
||||||
qualifiedReceiver.packageFqName,
|
listOf(
|
||||||
qualifiedReceiver.relativeClassFqName
|
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 processorForCallables: (FirCallableSymbol<*>) -> ProcessorAction = {
|
||||||
val fir = it.fir
|
val fir = it.fir
|
||||||
|
|||||||
+3
-3
@@ -5,8 +5,8 @@
|
|||||||
// FILE: CommonDataKeys.java
|
// FILE: CommonDataKeys.java
|
||||||
|
|
||||||
public class CommonDataKeys {
|
public class CommonDataKeys {
|
||||||
public static final String PROJECT = "project";
|
public static final String PROJECT = "project";
|
||||||
public final String MEMBER = "member"
|
public final String MEMBER = "member"
|
||||||
}
|
}
|
||||||
|
|
||||||
// FILE: PlatformDataKeys.java
|
// FILE: PlatformDataKeys.java
|
||||||
@@ -18,6 +18,6 @@ public class PlatformDataKeys extends CommonDataKeys {
|
|||||||
// FILE: main.kt
|
// FILE: main.kt
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val project = PlatformDataKeys.<!UNRESOLVED_REFERENCE!>PROJECT<!>
|
val project = PlatformDataKeys.PROJECT
|
||||||
val member = PlatformDataKeys().MEMBER
|
val member = PlatformDataKeys().MEMBER
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
FILE: main.kt
|
FILE: main.kt
|
||||||
public final fun test(): R|kotlin/Unit| {
|
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|
|
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");
|
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")
|
@TestMetadata("syntheticsVsNormalProperties.kt")
|
||||||
public void testSyntheticsVsNormalProperties() throws Exception {
|
public void testSyntheticsVsNormalProperties() throws Exception {
|
||||||
runTest("compiler/fir/resolve/testData/resolve/problems/syntheticsVsNormalProperties.kt");
|
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");
|
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")
|
@TestMetadata("StaticGenericMethod.kt")
|
||||||
public void testStaticGenericMethod() throws Exception {
|
public void testStaticGenericMethod() throws Exception {
|
||||||
runTest("compiler/fir/resolve/testData/resolve/stdlib/j+k/StaticGenericMethod.kt");
|
runTest("compiler/fir/resolve/testData/resolve/stdlib/j+k/StaticGenericMethod.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user