diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/objectDerivedFromInnerClass.fir.txt b/compiler/fir/analysis-tests/testData/resolve/problems/objectDerivedFromInnerClass.fir.txt index 1f60d04a326..b789824ebc3 100644 --- a/compiler/fir/analysis-tests/testData/resolve/problems/objectDerivedFromInnerClass.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/problems/objectDerivedFromInnerClass.fir.txt @@ -4,7 +4,7 @@ FILE: objectDerivedFromInnerClass.kt super() } - public final inner class Inner : R|kotlin/Any| { + public open inner class Inner : R|kotlin/Any| { public Outer.constructor(): R|Outer.Inner| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/objectDerivedFromInnerClass.kt b/compiler/fir/analysis-tests/testData/resolve/problems/objectDerivedFromInnerClass.kt index b3985793836..c4675e18159 100644 --- a/compiler/fir/analysis-tests/testData/resolve/problems/objectDerivedFromInnerClass.kt +++ b/compiler/fir/analysis-tests/testData/resolve/problems/objectDerivedFromInnerClass.kt @@ -1,4 +1,4 @@ -class Outer { inner class Inner } +class Outer { open inner class Inner } fun test() { val x = object : Outer.Inner() { } } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/CommonDeclarationCheckers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/CommonDeclarationCheckers.kt index 5344e262373..b0bf92fa2cb 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/CommonDeclarationCheckers.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/CommonDeclarationCheckers.kt @@ -90,6 +90,7 @@ object CommonDeclarationCheckers : DeclarationCheckers() { FirMemberPropertiesChecker, FirImplementationMismatchChecker, FirTypeParametersInObjectChecker, + FirSupertypesChecker, ) override val regularClassCheckers: Set @@ -101,7 +102,6 @@ object CommonDeclarationCheckers : DeclarationCheckers() { FirDelegationSuperCallInEnumConstructorChecker, FirDelegationInInterfaceSyntaxChecker, FirEnumClassSimpleChecker, - FirSupertypesChecker, FirLocalEntityNotAllowedChecker, FirManyCompanionObjectsChecker, FirMethodOfAnyImplementedInInterfaceChecker, diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypesChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypesChecker.kt index 145959ac309..08e6cf9a78b 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypesChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypesChecker.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.fir.analysis.checkers.declaration +import org.jetbrains.kotlin.KtFakeSourceElementKind import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.Modality @@ -30,6 +31,7 @@ import org.jetbrains.kotlin.name.StandardClassIds object FirSupertypesChecker : FirClassChecker() { override fun check(declaration: FirClass, context: CheckerContext, reporter: DiagnosticReporter) { + if (declaration.source?.kind is KtFakeSourceElementKind) return val isInterface = declaration.classKind == ClassKind.INTERFACE var nullableSupertypeReported = false var extensionFunctionSupertypeReported = false diff --git a/compiler/testData/diagnostics/tests/ProjectionsInSupertypes.fir.kt b/compiler/testData/diagnostics/tests/ProjectionsInSupertypes.fir.kt index dacb92af749..8a7a9371ea4 100644 --- a/compiler/testData/diagnostics/tests/ProjectionsInSupertypes.fir.kt +++ b/compiler/testData/diagnostics/tests/ProjectionsInSupertypes.fir.kt @@ -5,3 +5,4 @@ interface C {} interface D {} interface Test : A<in Int>, B<out Int>, C<*>???, D {} +val x = object : A<*> {} diff --git a/compiler/testData/diagnostics/tests/ProjectionsInSupertypes.kt b/compiler/testData/diagnostics/tests/ProjectionsInSupertypes.kt index 3b342cc6d35..d3c9983b47c 100644 --- a/compiler/testData/diagnostics/tests/ProjectionsInSupertypes.kt +++ b/compiler/testData/diagnostics/tests/ProjectionsInSupertypes.kt @@ -4,4 +4,5 @@ interface B {} interface C {} interface D {} -interface Test : A<in Int>, B<out Int>, C<*>???, D {} \ No newline at end of file +interface Test : A<in Int>, B<out Int>, C<*>???, D {} +val x = object : A<*> {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/ProjectionsInSupertypes.txt b/compiler/testData/diagnostics/tests/ProjectionsInSupertypes.txt index 6bd87e60c65..6e923a15f62 100644 --- a/compiler/testData/diagnostics/tests/ProjectionsInSupertypes.txt +++ b/compiler/testData/diagnostics/tests/ProjectionsInSupertypes.txt @@ -1,5 +1,7 @@ package +public val x: A<*> + public interface A { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int @@ -29,3 +31,4 @@ public interface Test : A, B, C<*>?, D) -> Int = { x: Foo<_> -> 10 } val x10 = object : _ {} - val x11 = object : Foo<_> {} + val x11 = object : Foo<_> {} if (x11 is _) { } if (x11 is Foo<_>) { }