From 49593d308c834d3966ce89419b47da2a590aa5f3 Mon Sep 17 00:00:00 2001 From: rapturemain Date: Thu, 23 Apr 2020 18:53:59 +0300 Subject: [PATCH] [FIR] Add EXPOSED_SUPER_(CLASS/INTERFACE) checker --- .../resolve/visibility/exposedSupertype.kt | 63 +++++++++++ .../resolve/visibility/exposedSupertype.txt | 100 ++++++++++++++++++ .../fir/FirDiagnosticsTestGenerated.java | 5 + ...DiagnosticsWithLightTreeTestGenerated.java | 5 + .../FirExposedVisibilityChecker.kt | 40 +++++-- .../fir/analysis/diagnostics/FirErrors.kt | 3 + .../kotlin/fir/FirEffectiveVisibilityUtils.kt | 1 - .../javaKotlinJavaCycle.fir.kt | 2 +- .../cyclicHierarchy/kotlinJavaCycle.fir.kt | 2 +- .../kotlinJavaKotlinCycle.fir.kt | 2 +- .../kotlinJavaNestedCycle.fir.kt | 2 +- .../diagnostics/tests/exposed/internal.fir.kt | 4 +- .../tests/exposed/internalAndProtected.fir.kt | 10 ++ .../tests/exposed/internalAndProtected.kt | 3 +- .../diagnostics/tests/exposed/object.fir.kt | 2 +- .../tests/exposed/protected.fir.kt | 4 +- .../tests/exposed/protectedInProtected.fir.kt | 12 --- .../tests/exposed/protectedInProtected.kt | 1 + .../tests/exposed/protectedJava.fir.kt | 2 +- .../tests/exposed/protectedSameWay.fir.kt | 2 +- .../diagnostics/tests/exposed/simple.fir.kt | 4 +- .../diagnostics/tests/exposed/typeArgs.fir.kt | 2 +- .../PackageLocalClassNotImported.fir.kt | 2 +- .../imports/PrivateClassNotImported.fir.kt | 2 +- .../tests/privateInFile/visibility.fir.kt | 2 +- .../tests/scopes/visibility2.fir.kt | 2 +- .../tests/scopes/visibility3.fir.kt | 2 +- 27 files changed, 241 insertions(+), 40 deletions(-) create mode 100644 compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.kt create mode 100644 compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.txt create mode 100644 compiler/testData/diagnostics/tests/exposed/internalAndProtected.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/exposed/protectedInProtected.fir.kt diff --git a/compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.kt b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.kt new file mode 100644 index 00000000000..3f66bd385d7 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.kt @@ -0,0 +1,63 @@ +class A { + protected interface AProtectedI { + + } + + interface APublicI { + + } +} + +class B { + protected class BProtected { + + } + + inner class BInner { + + } +} + +private class C { + class CPublic { + + } + + interface CPublicI { + + } +} + +class D : A { + class Test1 : A.AProtectedI { + + } +} + +interface E { + +} + +class Test2 : A.APublicI, B.BInner { + +} + +class Test3 : C.CPublicI, C { + +} + +class Test4 : E, A.AProtectedI { + +} + +class Test5 : C.CPublicI, B.BInner { + +} + +class Test6 : E, C.CPublic { + +} + +class Test7 : D.PublicButProtected { + +} \ No newline at end of file diff --git a/compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.txt b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.txt new file mode 100644 index 00000000000..bec501cd4d9 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.txt @@ -0,0 +1,100 @@ +FILE: exposedSupertype.kt + public final class A : R|kotlin/Any| { + public constructor(): R|A| { + super() + } + + protected abstract interface AProtectedI : R|kotlin/Any| { + } + + public abstract interface APublicI : R|kotlin/Any| { + } + + } + public final class B : R|kotlin/Any| { + public constructor(): R|B| { + super() + } + + protected final class BProtected : R|kotlin/Any| { + public[protected] constructor(): R|B.BProtected| { + super() + } + + } + + public final inner class BInner : R|kotlin/Any| { + public constructor(): R|B.BInner| { + super() + } + + } + + } + private final class C : R|kotlin/Any| { + public[private] constructor(): R|C| { + super() + } + + public[private] final class CPublic : R|kotlin/Any| { + public[private] constructor(): R|C.CPublic| { + super() + } + + } + + public[private] abstract interface CPublicI : R|kotlin/Any| { + } + + } + public final class D : R|A| { + public constructor(): R|D| { + super() + } + + public final class Test1 : R|A.AProtectedI| { + public constructor(): R|D.Test1| { + super() + } + + } + + } + public abstract interface E : R|kotlin/Any| { + } + public final class Test2 : R|A.APublicI|, R|B.BInner| { + public constructor(): R|Test2| { + super() + } + + } + public final class Test3 : R|C.CPublicI|, R|C| { + public constructor(): R|Test3| { + super() + } + + } + public final class Test4 : R|E|, R|A.AProtectedI| { + public constructor(): R|Test4| { + super() + } + + } + public final class Test5 : R|C.CPublicI|, R|B.BInner| { + public constructor(): R|Test5| { + super() + } + + } + public final class Test6 : R|E|, R|C.CPublic| { + public constructor(): R|Test6| { + super() + } + + } + public final class Test7 : R|ERROR CLASS: Symbol not found, for `D.PublicButProtected`| { + public constructor(): R|Test7| { + super() + } + + } diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java index 3e090f13683..f75010bbe2b 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java @@ -2168,6 +2168,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/visibility"), Pattern.compile("^([^.]+)\\.kt$"), null, true); } + @TestMetadata("exposedSupertype.kt") + public void testExposedSupertype() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.kt"); + } + @TestMetadata("exposedFunctionParameterType.kt") public void testExposedFunctionParameterType() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/visibility/exposedFunctionParameterType.kt"); diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java index b50ded56eae..43be7a3e3b6 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java @@ -2168,6 +2168,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/visibility"), Pattern.compile("^([^.]+)\\.kt$"), null, true); } + @TestMetadata("exposedSupertype.kt") + public void testExposedSupertype() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.kt"); + } + @TestMetadata("exposedFunctionParameterType.kt") public void testExposedFunctionParameterType() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/visibility/exposedFunctionParameterType.kt"); diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityChecker.kt index f0770956b01..99c76ea8b79 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirExposedVisibilityChecker.kt @@ -9,12 +9,15 @@ import com.intellij.lang.LighterASTNode import com.intellij.openapi.util.Ref import com.intellij.psi.PsiElement import com.intellij.psi.PsiNameIdentifierOwner +import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext +import org.jetbrains.kotlin.fir.analysis.checkers.toRegularClass import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticFactory3 import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.types.ConeClassLikeType import org.jetbrains.kotlin.fir.types.ConeKotlinType import org.jetbrains.kotlin.fir.types.FirTypeRef import org.jetbrains.kotlin.fir.types.coneTypeSafe @@ -23,13 +26,38 @@ import org.jetbrains.kotlin.lexer.KtTokens object FirExposedVisibilityChecker : FirDeclarationChecker() { override fun check(declaration: FirMemberDeclaration, context: CheckerContext, reporter: DiagnosticReporter) { when (declaration) { - is FirTypeAlias -> checkTypeAlias(declaration, context, reporter) - is FirProperty -> checkProperty(declaration, context, reporter) - is FirFunction<*> -> checkFunction(declaration, context, reporter) + is FirTypeAlias -> checkTypeAlias(declaration, reporter) + is FirProperty -> checkProperty(declaration, reporter) + is FirFunction<*> -> checkFunction(declaration, reporter) + is FirRegularClass -> checkSupertypes(declaration, reporter) } } - private fun checkTypeAlias(declaration: FirTypeAlias, context: CheckerContext, reporter: DiagnosticReporter) { + private fun checkSupertypes(declaration: FirRegularClass, reporter: DiagnosticReporter) { + val classVisibility = declaration.firEffectiveVisibility(declaration.session) + val supertypes = declaration.superTypeRefs + val isInterface = declaration.classKind == ClassKind.INTERFACE + for (supertypeRef in supertypes) { + val supertype = supertypeRef.coneTypeSafe() ?: continue + val clazz = supertype.toRegularClass(declaration.session) ?: continue + val superIsInterface = clazz.classKind == ClassKind.INTERFACE + if (superIsInterface != isInterface) { + continue + } + val restricting = supertype.leastPermissiveDescriptor(declaration.session, classVisibility) + if (restricting != null) { + reporter.reportExposure( + if (isInterface) FirErrors.EXPOSED_SUPER_INTERFACE else FirErrors.EXPOSED_SUPER_CLASS, + restricting, + classVisibility, + restricting.firEffectiveVisibility(declaration.session), + supertypeRef.source ?: declaration.source + ) + } + } + } + + private fun checkTypeAlias(declaration: FirTypeAlias, reporter: DiagnosticReporter) { val expandedType = declaration.expandedConeType val typeAliasVisibility = declaration.firEffectiveVisibility(declaration.session) val restricting = expandedType?.leastPermissiveDescriptor(declaration.session, typeAliasVisibility) @@ -44,7 +72,7 @@ object FirExposedVisibilityChecker : FirDeclarationChecker } } - private fun checkFunction(declaration: FirFunction<*>, context: CheckerContext, reporter: DiagnosticReporter) { + private fun checkFunction(declaration: FirFunction<*>, reporter: DiagnosticReporter) { val functionVisibility = (declaration as FirMemberDeclaration).firEffectiveVisibility(declaration.session) if (declaration !is FirConstructor) { val restricting = declaration.returnTypeRef.coneTypeSafe() @@ -78,7 +106,7 @@ object FirExposedVisibilityChecker : FirDeclarationChecker checkMemberReceiver(declaration.receiverTypeRef, declaration as? FirCallableMemberDeclaration<*>, reporter) } - private fun checkProperty(declaration: FirProperty, context: CheckerContext, reporter: DiagnosticReporter) { + private fun checkProperty(declaration: FirProperty, reporter: DiagnosticReporter) { val propertyVisibility = declaration.firEffectiveVisibility(declaration.session) val restricting = declaration.returnTypeRef.coneTypeSafe()?.leastPermissiveDescriptor(declaration.session, propertyVisibility) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index 366706ff463..74fa45384a0 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -15,6 +15,7 @@ import org.jetbrains.kotlin.fir.types.ConeKotlinType import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.lexer.KtModifierKeywordToken import org.jetbrains.kotlin.psi.KtParameter +import org.jetbrains.kotlin.psi.KtSuperTypeListEntry import org.jetbrains.kotlin.psi.KtTypeReference object FirErrors { @@ -58,6 +59,8 @@ object FirErrors { val EXPOSED_RECEIVER_TYPE by error3() val EXPOSED_PROPERTY_TYPE by error3() val EXPOSED_PARAMETER_TYPE by error3() + val EXPOSED_SUPER_INTERFACE by error3() + val EXPOSED_SUPER_CLASS by error3() val REPEATED_MODIFIER by error1() val REDUNDANT_MODIFIER by error2() diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirEffectiveVisibilityUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirEffectiveVisibilityUtils.kt index 35c710c83cb..b45c4b46f69 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirEffectiveVisibilityUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirEffectiveVisibilityUtils.kt @@ -65,7 +65,6 @@ private fun FirMemberDeclaration.containingClass(session: FirSession): FirRegula else -> null } ?: return null if (classId.isLocal) return null - val buffer = session.declaredMemberScopeProvider.getClassByClassId(classId) return (session.firSymbolProvider.getClassLikeSymbolByFqName(classId)?.fir as? FirRegularClass) ?: (session.declaredMemberScopeProvider.getClassByClassId(classId) as? FirRegularClass) } diff --git a/compiler/testData/diagnostics/tests/cyclicHierarchy/javaKotlinJavaCycle.fir.kt b/compiler/testData/diagnostics/tests/cyclicHierarchy/javaKotlinJavaCycle.fir.kt index 12cc4ee45a1..0ee5c285c19 100644 --- a/compiler/testData/diagnostics/tests/cyclicHierarchy/javaKotlinJavaCycle.fir.kt +++ b/compiler/testData/diagnostics/tests/cyclicHierarchy/javaKotlinJavaCycle.fir.kt @@ -6,7 +6,7 @@ interface A extends C { // FILE: B.kt -interface B : A { +interface B : A { fun bar() } diff --git a/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaCycle.fir.kt b/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaCycle.fir.kt index c362c08bc1e..8002261c5b9 100644 --- a/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaCycle.fir.kt +++ b/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaCycle.fir.kt @@ -6,6 +6,6 @@ class J extends K { // FILE: K.kt -class K : J() { +class K : J() { fun bar() {} } diff --git a/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaKotlinCycle.fir.kt b/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaKotlinCycle.fir.kt index d4241960250..1b48daaedd1 100644 --- a/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaKotlinCycle.fir.kt +++ b/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaKotlinCycle.fir.kt @@ -12,6 +12,6 @@ class J extends I { // FILE: K.kt -open class K : J() { +open class K : J() { fun baz() {} } diff --git a/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaNestedCycle.fir.kt b/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaNestedCycle.fir.kt index bcd66b00875..cf752aecdd6 100644 --- a/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaNestedCycle.fir.kt +++ b/compiler/testData/diagnostics/tests/cyclicHierarchy/kotlinJavaNestedCycle.fir.kt @@ -1,6 +1,6 @@ // FILE: ExceptionTracker.kt -interface ExceptionTracker : LockBasedStorageManager.ExceptionHandlingStrategy { +interface ExceptionTracker : LockBasedStorageManager.ExceptionHandlingStrategy { } // FILE: StorageManager.kt diff --git a/compiler/testData/diagnostics/tests/exposed/internal.fir.kt b/compiler/testData/diagnostics/tests/exposed/internal.fir.kt index a0ba8621f61..565c9596f54 100644 --- a/compiler/testData/diagnostics/tests/exposed/internal.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/internal.fir.kt @@ -7,7 +7,7 @@ internal open class Your: My() { } // error, public from internal -open class His: Your() { +open class His: Your() { protected open class Nested // error, public from internal val x = My() @@ -21,5 +21,5 @@ open class His: Your() { internal class Their: His() { // error, effectively internal from protected - class InnerDerived: His.Nested() + class InnerDerived: His.Nested() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/exposed/internalAndProtected.fir.kt b/compiler/testData/diagnostics/tests/exposed/internalAndProtected.fir.kt new file mode 100644 index 00000000000..394273d9dad --- /dev/null +++ b/compiler/testData/diagnostics/tests/exposed/internalAndProtected.fir.kt @@ -0,0 +1,10 @@ +public open class A { + protected open class B +} + +public open class C : A() { + protected open class D { + // internal & protected(in C) <= protected(in A): Ok + internal open class E : A.B() + } +} diff --git a/compiler/testData/diagnostics/tests/exposed/internalAndProtected.kt b/compiler/testData/diagnostics/tests/exposed/internalAndProtected.kt index cde0f4a7fe1..25d2b2f6780 100644 --- a/compiler/testData/diagnostics/tests/exposed/internalAndProtected.kt +++ b/compiler/testData/diagnostics/tests/exposed/internalAndProtected.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL public open class A { protected open class B } @@ -6,6 +5,6 @@ public open class A { public open class C : A() { protected open class D { // internal & protected(in C) <= protected(in A): Ok - internal open class E : A.B() + internal open class E : A.B() } } diff --git a/compiler/testData/diagnostics/tests/exposed/object.fir.kt b/compiler/testData/diagnostics/tests/exposed/object.fir.kt index 5d9dd183b00..37cc25675d0 100644 --- a/compiler/testData/diagnostics/tests/exposed/object.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/object.fir.kt @@ -1,5 +1,5 @@ // From KT-10753 -object My : Inter() { +object My : Inter() { fun foo(arg: Inter): Inter = arg val x: Inter? = null } diff --git a/compiler/testData/diagnostics/tests/exposed/protected.fir.kt b/compiler/testData/diagnostics/tests/exposed/protected.fir.kt index 88919501eba..ceeb5c42e65 100644 --- a/compiler/testData/diagnostics/tests/exposed/protected.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/protected.fir.kt @@ -5,13 +5,13 @@ open class A { } public open class C { // protected relative to C, must be an error - protected open class D : B() + protected open class D : B() } } class E : A.C() { // F has invisible grandparent class B (E does not inherit from A) - class F : A.C.D() { + class F : A.C.D() { init { // Invoke function from invisible grandparent foo() diff --git a/compiler/testData/diagnostics/tests/exposed/protectedInProtected.fir.kt b/compiler/testData/diagnostics/tests/exposed/protectedInProtected.fir.kt deleted file mode 100644 index 9c55dbc067d..00000000000 --- a/compiler/testData/diagnostics/tests/exposed/protectedInProtected.fir.kt +++ /dev/null @@ -1,12 +0,0 @@ -// See KT-9540 - -// all protected should have lower bound that is more permissive than private -// protected and internal should have lower bound that is more permissive than private -open class A { - private interface B - protected open class C { - protected interface D : B - internal interface E : B, D - } -} - diff --git a/compiler/testData/diagnostics/tests/exposed/protectedInProtected.kt b/compiler/testData/diagnostics/tests/exposed/protectedInProtected.kt index 342e949463a..ac326a36e6a 100644 --- a/compiler/testData/diagnostics/tests/exposed/protectedInProtected.kt +++ b/compiler/testData/diagnostics/tests/exposed/protectedInProtected.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // See KT-9540 // all protected should have lower bound that is more permissive than private diff --git a/compiler/testData/diagnostics/tests/exposed/protectedJava.fir.kt b/compiler/testData/diagnostics/tests/exposed/protectedJava.fir.kt index 7dc16417a2e..2276a93325a 100644 --- a/compiler/testData/diagnostics/tests/exposed/protectedJava.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/protectedJava.fir.kt @@ -10,7 +10,7 @@ public abstract class Outer { class OuterDerived: Outer() { // valid, My has better visibility - protected class His: Outer.My() + protected class His: Outer.My() // valid, My and Your have better visibility override fun foo(my: Outer.My) = Outer.Your() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/exposed/protectedSameWay.fir.kt b/compiler/testData/diagnostics/tests/exposed/protectedSameWay.fir.kt index 6a0cc23ebf3..2acdd1386c7 100644 --- a/compiler/testData/diagnostics/tests/exposed/protectedSameWay.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/protectedSameWay.fir.kt @@ -7,7 +7,7 @@ abstract class Outer { class OuterDerived: Outer() { // valid, My has better visibility - protected class His: Outer.My() + protected class His: Outer.My() // valid, My and Your have better visibility override fun foo(my: Outer.My) = Outer.Your() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/exposed/simple.fir.kt b/compiler/testData/diagnostics/tests/exposed/simple.fir.kt index c8d98b7ea25..ea8031abf45 100644 --- a/compiler/testData/diagnostics/tests/exposed/simple.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/simple.fir.kt @@ -2,11 +2,11 @@ private interface My private open class Base -public interface Your: My { +public interface Your: My { fun foo(): T } -public class Derived(val x: My): Base() { +public class Derived(val x: My): Base() { constructor(xx: My?, x: My): this(xx ?: x) diff --git a/compiler/testData/diagnostics/tests/exposed/typeArgs.fir.kt b/compiler/testData/diagnostics/tests/exposed/typeArgs.fir.kt index 4331ca30370..91ab7d42a03 100644 --- a/compiler/testData/diagnostics/tests/exposed/typeArgs.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/typeArgs.fir.kt @@ -6,7 +6,7 @@ abstract class Your { } // invalid, List is effectively internal -interface His: List +interface His: List // invalid, My is internal interface Generic diff --git a/compiler/testData/diagnostics/tests/imports/PackageLocalClassNotImported.fir.kt b/compiler/testData/diagnostics/tests/imports/PackageLocalClassNotImported.fir.kt index bea3b640a56..a5592ef7931 100644 --- a/compiler/testData/diagnostics/tests/imports/PackageLocalClassNotImported.fir.kt +++ b/compiler/testData/diagnostics/tests/imports/PackageLocalClassNotImported.fir.kt @@ -14,4 +14,4 @@ package a import pack1.* import pack2.* -class X : SomeClass() +class X : SomeClass() diff --git a/compiler/testData/diagnostics/tests/imports/PrivateClassNotImported.fir.kt b/compiler/testData/diagnostics/tests/imports/PrivateClassNotImported.fir.kt index 7510fdfe1bd..f65626c3aa4 100644 --- a/compiler/testData/diagnostics/tests/imports/PrivateClassNotImported.fir.kt +++ b/compiler/testData/diagnostics/tests/imports/PrivateClassNotImported.fir.kt @@ -17,5 +17,5 @@ package a import pack1.SomeClass.* import pack2.* -class X : N() +class X : N() class Y : PublicNested() diff --git a/compiler/testData/diagnostics/tests/privateInFile/visibility.fir.kt b/compiler/testData/diagnostics/tests/privateInFile/visibility.fir.kt index e238dd90988..b864aefbc5d 100644 --- a/compiler/testData/diagnostics/tests/privateInFile/visibility.fir.kt +++ b/compiler/testData/diagnostics/tests/privateInFile/visibility.fir.kt @@ -43,7 +43,7 @@ fun test() { xx = 40 } -class B : A() {} +class B : A() {} class Q { class W { diff --git a/compiler/testData/diagnostics/tests/scopes/visibility2.fir.kt b/compiler/testData/diagnostics/tests/scopes/visibility2.fir.kt index 96f7aa08eb6..d9d674129ca 100644 --- a/compiler/testData/diagnostics/tests/scopes/visibility2.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/visibility2.fir.kt @@ -33,7 +33,7 @@ fun test() { val po = PO } -class B : A() {} +class B : A() {} class Q { class W { diff --git a/compiler/testData/diagnostics/tests/scopes/visibility3.fir.kt b/compiler/testData/diagnostics/tests/scopes/visibility3.fir.kt index 4f910489c7f..d9ef372f7fa 100644 --- a/compiler/testData/diagnostics/tests/scopes/visibility3.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/visibility3.fir.kt @@ -36,7 +36,7 @@ fun test() { val po = PO } -class B : A() {} +class B : A() {} class Q { class W {