[FIR] Ignore inaccessible members in FirImplementationMismatchChecker
^KT-61076 Fixed
This commit is contained in:
committed by
Space Team
parent
00d6ced263
commit
ef338865c7
+6
@@ -1137,6 +1137,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/suppressInWhen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendFunAndPrivateJava.kt")
|
||||
public void testSuspendFunAndPrivateJava() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/suspendFunAndPrivateJava.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SyntaxErrorInTestHighlighting.kt")
|
||||
public void testSyntaxErrorInTestHighlighting() throws Exception {
|
||||
|
||||
+6
@@ -1137,6 +1137,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/suppressInWhen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendFunAndPrivateJava.kt")
|
||||
public void testSuspendFunAndPrivateJava() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/suspendFunAndPrivateJava.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SyntaxErrorInTestHighlighting.kt")
|
||||
public void testSyntaxErrorInTestHighlighting() throws Exception {
|
||||
|
||||
+6
@@ -1137,6 +1137,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/suppressInWhen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendFunAndPrivateJava.kt")
|
||||
public void testSuspendFunAndPrivateJava() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/suspendFunAndPrivateJava.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SyntaxErrorInTestHighlighting.kt")
|
||||
public void testSyntaxErrorInTestHighlighting() throws Exception {
|
||||
|
||||
+6
@@ -1137,6 +1137,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/suppressInWhen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendFunAndPrivateJava.kt")
|
||||
public void testSuspendFunAndPrivateJava() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/suspendFunAndPrivateJava.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SyntaxErrorInTestHighlighting.kt")
|
||||
public void testSyntaxErrorInTestHighlighting() throws Exception {
|
||||
|
||||
+17
-7
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.diagnostics.impl.deduplicating
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||
import org.jetbrains.kotlin.diagnostics.reportOn
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.isVisibleInClass
|
||||
import org.jetbrains.kotlin.fir.containingClassLookupTag
|
||||
import org.jetbrains.kotlin.fir.declarations.FirClass
|
||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||
@@ -188,6 +189,21 @@ object FirImplementationMismatchChecker : FirClassChecker() {
|
||||
reporter.reportOn(containingClass.source, FirErrors.VAR_OVERRIDDEN_BY_VAL_BY_DELEGATION, symbol, overriddenVar, context)
|
||||
}
|
||||
|
||||
private fun FirTypeScope.collectFunctionsNamed(name: Name, containingClass: FirClass): List<FirNamedFunctionSymbol> {
|
||||
val allFunctions = mutableListOf<FirNamedFunctionSymbol>()
|
||||
|
||||
processFunctionsByName(name) { sym ->
|
||||
when (sym) {
|
||||
is FirIntersectionOverrideFunctionSymbol -> sym.intersections.mapNotNullTo(allFunctions) { it as? FirNamedFunctionSymbol }
|
||||
else -> allFunctions.add(sym)
|
||||
}
|
||||
}
|
||||
|
||||
return allFunctions.filter {
|
||||
it.isVisibleInClass(containingClass.symbol)
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkConflictingMembers(
|
||||
containingClass: FirClass,
|
||||
context: CheckerContext,
|
||||
@@ -195,13 +211,7 @@ object FirImplementationMismatchChecker : FirClassChecker() {
|
||||
scope: FirTypeScope,
|
||||
name: Name
|
||||
) {
|
||||
val allFunctions = mutableListOf<FirNamedFunctionSymbol>()
|
||||
scope.processFunctionsByName(name) { sym ->
|
||||
when (sym) {
|
||||
is FirIntersectionOverrideFunctionSymbol -> sym.intersections.mapNotNullTo(allFunctions) { it as? FirNamedFunctionSymbol }
|
||||
else -> allFunctions.add(sym)
|
||||
}
|
||||
}
|
||||
val allFunctions = scope.collectFunctionsNamed(name, containingClass)
|
||||
|
||||
val sameArgumentGroups = allFunctions.groupBy { function ->
|
||||
buildList {
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-61076
|
||||
// FILE: InspectionApplicationBase.java
|
||||
|
||||
public class InspectionApplicationBase {
|
||||
private String loadInspectionProfile() { return ""; }
|
||||
}
|
||||
|
||||
// FILE: Main.kt
|
||||
|
||||
class QodanaInspectionApplication: InspectionApplicationBase() {
|
||||
suspend fun loadInspectionProfile(): String = ""
|
||||
}
|
||||
Generated
+6
@@ -1137,6 +1137,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/suppressInWhen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendFunAndPrivateJava.kt")
|
||||
public void testSuspendFunAndPrivateJava() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/suspendFunAndPrivateJava.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SyntaxErrorInTestHighlighting.kt")
|
||||
public void testSyntaxErrorInTestHighlighting() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user