[FIR] Consider anonymous objects in FirSuperclassNotAccessibleFromInterfaceChecker
^KT-54673 Fixed
This commit is contained in:
committed by
Space Team
parent
adeb31ebf6
commit
6e76978530
+6
@@ -32244,6 +32244,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/thisAndSuper/ambigousLabelOnThis.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("considerAnonymousObjectsForSuperclassNotAccessibleFromInterface.kt")
|
||||
public void testConsiderAnonymousObjectsForSuperclassNotAccessibleFromInterface() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/thisAndSuper/considerAnonymousObjectsForSuperclassNotAccessibleFromInterface.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericQualifiedSuperOverridden.kt")
|
||||
public void testGenericQualifiedSuperOverridden() throws Exception {
|
||||
|
||||
+6
@@ -32244,6 +32244,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/thisAndSuper/ambigousLabelOnThis.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("considerAnonymousObjectsForSuperclassNotAccessibleFromInterface.kt")
|
||||
public void testConsiderAnonymousObjectsForSuperclassNotAccessibleFromInterface() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/thisAndSuper/considerAnonymousObjectsForSuperclassNotAccessibleFromInterface.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericQualifiedSuperOverridden.kt")
|
||||
public void testGenericQualifiedSuperOverridden() throws Exception {
|
||||
|
||||
+6
@@ -32244,6 +32244,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/thisAndSuper/ambigousLabelOnThis.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("considerAnonymousObjectsForSuperclassNotAccessibleFromInterface.kt")
|
||||
public void testConsiderAnonymousObjectsForSuperclassNotAccessibleFromInterface() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/thisAndSuper/considerAnonymousObjectsForSuperclassNotAccessibleFromInterface.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericQualifiedSuperOverridden.kt")
|
||||
public void testGenericQualifiedSuperOverridden() throws Exception {
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ import org.jetbrains.kotlin.fir.analysis.checkers.context.findClosest
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.explicitReceiverIsNotSuperReference
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.getContainingClassSymbol
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||
import org.jetbrains.kotlin.fir.declarations.FirClass
|
||||
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.toResolvedCallableSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
||||
@@ -22,7 +22,7 @@ object FirSuperclassNotAccessibleFromInterfaceChecker : FirQualifiedAccessExpres
|
||||
override fun check(expression: FirQualifiedAccessExpression, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (expression.explicitReceiverIsNotSuperReference()) return
|
||||
|
||||
val closestClass = context.findClosest<FirRegularClass>() ?: return
|
||||
val closestClass = context.findClosest<FirClass>() ?: return
|
||||
|
||||
if (closestClass.classKind == ClassKind.INTERFACE) {
|
||||
val containingClassSymbol =
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-54673
|
||||
|
||||
open class KotlinBaseClass {
|
||||
open fun kotlinFun() {}
|
||||
}
|
||||
|
||||
interface sealedInterface {
|
||||
fun someFun() {
|
||||
object : KotlinBaseClass() {
|
||||
override fun kotlinFun() {
|
||||
super.kotlinFun()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package
|
||||
|
||||
public open class KotlinBaseClass {
|
||||
public constructor KotlinBaseClass()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun kotlinFun(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface sealedInterface {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun someFun(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Generated
+6
@@ -32334,6 +32334,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/thisAndSuper/ambigousLabelOnThis.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("considerAnonymousObjectsForSuperclassNotAccessibleFromInterface.kt")
|
||||
public void testConsiderAnonymousObjectsForSuperclassNotAccessibleFromInterface() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/thisAndSuper/considerAnonymousObjectsForSuperclassNotAccessibleFromInterface.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericQualifiedSuperOverridden.kt")
|
||||
public void testGenericQualifiedSuperOverridden() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user