From 8960829c01b5949347230c504a13e4910793a9a8 Mon Sep 17 00:00:00 2001 From: rapturemain Date: Sat, 18 Apr 2020 00:10:59 +0300 Subject: [PATCH] [FIR] Cast error on the element name instead of the whole body --- .../visibility/exposedFunctionReturnType.kt | 2 +- .../resolve/visibility/exposedPropertyType.kt | 4 +-- .../resolve/visibility/exposedTypeAlias.kt | 4 +-- .../FirExposedVisibilityChecker.kt | 20 +++++++++++-- .../enum/classObjectInEnumPrivate.fir.kt | 2 +- .../tests/exposed/functional.fir.kt | 12 -------- .../diagnostics/tests/exposed/functional.kt | 1 + .../diagnostics/tests/exposed/internal.fir.kt | 4 +-- .../tests/exposed/internalFromLocal.fir.kt | 10 ------- .../tests/exposed/internalFromLocal.kt | 1 + .../diagnostics/tests/exposed/local.fir.kt | 18 ----------- .../diagnostics/tests/exposed/local.kt | 1 + .../tests/exposed/localInFunReturnType.fir.kt | 12 ++++---- .../tests/exposed/localInMemberType.fir.kt | 21 ------------- .../tests/exposed/localInMemberType.kt | 1 + .../tests/exposed/localInPropertyType.fir.kt | 12 ++++---- .../diagnostics/tests/exposed/object.fir.kt | 12 ++++---- .../propertyInPrivateConstructor.fir.kt | 2 +- .../propertyInSimpleConstructor.fir.kt | 2 +- .../tests/exposed/protectedJava.fir.kt | 2 +- .../tests/exposed/protectedSameWay.fir.kt | 2 +- .../diagnostics/tests/exposed/simple.fir.kt | 8 ++--- .../diagnostics/tests/exposed/typeArgs.fir.kt | 2 +- .../ImportPrivateMembersWithStar.fir.kt | 2 +- .../tests/imports/ImportProtectedClass.fir.kt | 2 +- .../imports/InaccessiblePrivateClass.fir.kt | 4 +-- .../tests/j+k/packageVisibility.fir.kt | 4 +-- .../tests/privateInFile/visibility.fir.kt | 2 +- .../resolve/constructorVsCompanion.fir.kt | 2 +- .../tests/scopes/visibility2.fir.kt | 2 +- .../tests/scopes/visibility3.fir.kt | 2 +- .../subtyping/nestedIntoLocalClasses.fir.kt | 4 +-- .../typealias/exposedExpandedType.fir.kt | 30 +++++++++---------- .../typealias/typeAliasInvisibleObject.fir.kt | 4 +-- .../InaccessibleInternalClass.fir.kt | 4 +-- 35 files changed, 87 insertions(+), 130 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/exposed/functional.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/exposed/internalFromLocal.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/exposed/local.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/exposed/localInMemberType.fir.kt diff --git a/compiler/fir/analysis-tests/testData/resolve/visibility/exposedFunctionReturnType.kt b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedFunctionReturnType.kt index 3872c032051..5b8bff1c10c 100644 --- a/compiler/fir/analysis-tests/testData/resolve/visibility/exposedFunctionReturnType.kt +++ b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedFunctionReturnType.kt @@ -5,5 +5,5 @@ class A { } abstract class B { - fun foo(str: String): A.InnerA + fun foo(str: String): A.InnerA } \ No newline at end of file diff --git a/compiler/fir/analysis-tests/testData/resolve/visibility/exposedPropertyType.kt b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedPropertyType.kt index 5bf53920edd..b464599d35a 100644 --- a/compiler/fir/analysis-tests/testData/resolve/visibility/exposedPropertyType.kt +++ b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedPropertyType.kt @@ -17,7 +17,7 @@ class Property { var var1: String var var2: String var var3: Int - var var4: A.AInnerPrivate + var var4: A.AInnerPrivate var var5: A.AInnerPublic - var var6: A.AInnerProtectedEnum + var var6: A.AInnerProtectedEnum } \ No newline at end of file diff --git a/compiler/fir/analysis-tests/testData/resolve/visibility/exposedTypeAlias.kt b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedTypeAlias.kt index 56101f4495f..947d5256c05 100644 --- a/compiler/fir/analysis-tests/testData/resolve/visibility/exposedTypeAlias.kt +++ b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedTypeAlias.kt @@ -2,7 +2,7 @@ class A { private inner class Inner } class B { - typealias AInner = A.Inner + typealias AInner = A.Inner inner class Inner } @@ -10,5 +10,5 @@ class C { typealias BInner = B.Inner } -typealias AInner0 = A.Inner +typealias AInner0 = A.Inner typealias BInner0 = B.Inner \ No newline at end of file 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 b8e0d393a8f..f0770956b01 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 @@ -5,7 +5,10 @@ package org.jetbrains.kotlin.fir.analysis.checkers.declaration +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.fir.* import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter @@ -15,6 +18,7 @@ import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.types.ConeKotlinType import org.jetbrains.kotlin.fir.types.FirTypeRef import org.jetbrains.kotlin.fir.types.coneTypeSafe +import org.jetbrains.kotlin.lexer.KtTokens object FirExposedVisibilityChecker : FirDeclarationChecker() { override fun check(declaration: FirMemberDeclaration, context: CheckerContext, reporter: DiagnosticReporter) { @@ -35,7 +39,7 @@ object FirExposedVisibilityChecker : FirDeclarationChecker restricting, typeAliasVisibility, restricting.firEffectiveVisibility(declaration.session), - declaration.source + declaration.source?.getIdentifierSource() ?: declaration.source ) } } @@ -51,7 +55,7 @@ object FirExposedVisibilityChecker : FirDeclarationChecker restricting, functionVisibility, restricting.firEffectiveVisibility(declaration.session), - declaration.source + declaration.source?.getIdentifierSource() ?: declaration.source ) } } @@ -84,7 +88,7 @@ object FirExposedVisibilityChecker : FirDeclarationChecker restricting, propertyVisibility, restricting.firEffectiveVisibility(declaration.session), - declaration.source + declaration.source?.getIdentifierSource() ?: declaration.source ) } checkMemberReceiver(declaration.receiverTypeRef, declaration, reporter) @@ -127,4 +131,14 @@ object FirExposedVisibilityChecker : FirDeclarationChecker ) } } + + private fun FirSourceElement.getIdentifierSource() = when (this) { + is FirPsiSourceElement<*> -> (this.psi as? PsiNameIdentifierOwner)?.nameIdentifier?.toFirPsiSourceElement() + is FirLightSourceElement -> { + val kidsRef = Ref>() + this.tree.getChildren(this.element, kidsRef) + val identifier = kidsRef.get().find { it?.tokenType == KtTokens.IDENTIFIER } + identifier?.toFirLightSourceElement(this.tree.getStartOffset(identifier), this.tree.getEndOffset(identifier), this.tree) + } + } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/enum/classObjectInEnumPrivate.fir.kt b/compiler/testData/diagnostics/tests/enum/classObjectInEnumPrivate.fir.kt index 464369fd915..b13ef37b74e 100644 --- a/compiler/testData/diagnostics/tests/enum/classObjectInEnumPrivate.fir.kt +++ b/compiler/testData/diagnostics/tests/enum/classObjectInEnumPrivate.fir.kt @@ -7,4 +7,4 @@ enum class E { fun foo() = E.values() fun bar() = E.valueOf("ENTRY") fun baz() = E.ENTRY -fun quux() = E \ No newline at end of file +fun quux() = E \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/exposed/functional.fir.kt b/compiler/testData/diagnostics/tests/exposed/functional.fir.kt deleted file mode 100644 index f84e5e67306..00000000000 --- a/compiler/testData/diagnostics/tests/exposed/functional.fir.kt +++ /dev/null @@ -1,12 +0,0 @@ -internal class My - -class Your - -// Both arguments should be exposed -fun foo(my: My, f: (My) -> Unit) = f(my) - -// Ok -fun bar(your: Your, f: (Your) -> Unit) = f(your) - -// Exposed, returns My -fun gav(f: () -> My) = f() \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/exposed/functional.kt b/compiler/testData/diagnostics/tests/exposed/functional.kt index deb98d95985..8866406a68a 100644 --- a/compiler/testData/diagnostics/tests/exposed/functional.kt +++ b/compiler/testData/diagnostics/tests/exposed/functional.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL internal class My class Your diff --git a/compiler/testData/diagnostics/tests/exposed/internal.fir.kt b/compiler/testData/diagnostics/tests/exposed/internal.fir.kt index 4ebccb7479f..a0ba8621f61 100644 --- a/compiler/testData/diagnostics/tests/exposed/internal.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/internal.fir.kt @@ -10,13 +10,13 @@ internal open class Your: My() { open class His: Your() { protected open class Nested // error, public from internal - val x = My() + val x = My() // valid, private from internal private fun bar() = My() // valid, internal from internal internal var y: My? = null // error, protected from internal - protected fun baz() = Your() + protected fun baz() = Your() } internal class Their: His() { diff --git a/compiler/testData/diagnostics/tests/exposed/internalFromLocal.fir.kt b/compiler/testData/diagnostics/tests/exposed/internalFromLocal.fir.kt deleted file mode 100644 index 5059138800c..00000000000 --- a/compiler/testData/diagnostics/tests/exposed/internalFromLocal.fir.kt +++ /dev/null @@ -1,10 +0,0 @@ -interface Your - -class My { - internal val x = object : Your {} - - internal fun foo() = { - class Local - Local() - }() -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/exposed/internalFromLocal.kt b/compiler/testData/diagnostics/tests/exposed/internalFromLocal.kt index 3c7043385f6..91ef4701d52 100644 --- a/compiler/testData/diagnostics/tests/exposed/internalFromLocal.kt +++ b/compiler/testData/diagnostics/tests/exposed/internalFromLocal.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL interface Your class My { diff --git a/compiler/testData/diagnostics/tests/exposed/local.fir.kt b/compiler/testData/diagnostics/tests/exposed/local.fir.kt deleted file mode 100644 index e3a36a81fb9..00000000000 --- a/compiler/testData/diagnostics/tests/exposed/local.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -// invalid, depends on local class -fun foo() = run { - class A - A() -} - -// invalid, depends on local class -fun gav() = { - class B - B() -} - -abstract class My - -// valid, object literal here is effectively My -fun bar() = run { - object: My() {} -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/exposed/local.kt b/compiler/testData/diagnostics/tests/exposed/local.kt index 78a6f3cc2a1..8af2cedeb57 100644 --- a/compiler/testData/diagnostics/tests/exposed/local.kt +++ b/compiler/testData/diagnostics/tests/exposed/local.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // invalid, depends on local class fun foo() = run { class A diff --git a/compiler/testData/diagnostics/tests/exposed/localInFunReturnType.fir.kt b/compiler/testData/diagnostics/tests/exposed/localInFunReturnType.fir.kt index d3134ef52de..f417bf192f4 100644 --- a/compiler/testData/diagnostics/tests/exposed/localInFunReturnType.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/localInFunReturnType.fir.kt @@ -2,27 +2,27 @@ class My(val value: T) open class Base -fun invalid1() = run { +fun invalid1() = run { class Local My(Local()) -} +} fun invalid2() = My(object {}) fun invalid3() = My(object : Base() {}) -fun invalid4() = run { +fun invalid4() = run { class Local My(My(Local())) -} +} -fun invalid5() = run { +fun invalid5() = run { fun invalid5a() = run { class Local Local() } My(invalid5a()) -} +} // Valid: effectively Any fun valid1() = object {} diff --git a/compiler/testData/diagnostics/tests/exposed/localInMemberType.fir.kt b/compiler/testData/diagnostics/tests/exposed/localInMemberType.fir.kt deleted file mode 100644 index a496ac3b54f..00000000000 --- a/compiler/testData/diagnostics/tests/exposed/localInMemberType.fir.kt +++ /dev/null @@ -1,21 +0,0 @@ -class Something { - public val publicVal1 = object { override fun toString() = "!" } - protected val protectedVal1 = object { override fun toString() = "!" } - internal val internalVal1 = object { override fun toString() = "!" } - private val privateVal1 = object { override fun toString() = "!" } - - public val publicVal2 = run { class A; A() } - protected val protectedVal2 = run { class A; A() } - internal val internalVal2 = run { class A; A() } - private val privateVal2 = run { class A; A() } - - public fun publicFun1() = object { override fun toString() = "!" } - protected fun protectedFun1() = object { override fun toString() = "!" } - internal fun internalFun1() = object { override fun toString() = "!" } - private fun privateFun1() = object { override fun toString() = "!" } - - public fun publicFun2() = run { class A; A() } - protected fun protectedFun2() = run { class A; A() } - internal fun internalFun2() = run { class A; A() } - private fun privateFun2() = run { class A; A() } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/exposed/localInMemberType.kt b/compiler/testData/diagnostics/tests/exposed/localInMemberType.kt index 8d7af475f85..8f949f7ab86 100644 --- a/compiler/testData/diagnostics/tests/exposed/localInMemberType.kt +++ b/compiler/testData/diagnostics/tests/exposed/localInMemberType.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL class Something { public val publicVal1 = object { override fun toString() = "!" } protected val protectedVal1 = object { override fun toString() = "!" } diff --git a/compiler/testData/diagnostics/tests/exposed/localInPropertyType.fir.kt b/compiler/testData/diagnostics/tests/exposed/localInPropertyType.fir.kt index 55b74852bdb..2de6615197d 100644 --- a/compiler/testData/diagnostics/tests/exposed/localInPropertyType.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/localInPropertyType.fir.kt @@ -2,27 +2,27 @@ class My(val value: T) open class Base -val invalid1 = run { +val invalid1 = run { class Local My(Local()) -} +} val invalid2 = My(object {}) val invalid3 = My(object : Base() {}) -val invalid4 = run { +val invalid4 = run { class Local My(My(Local())) -} +} -val invalid5 = run { +val invalid5 = run { fun invalid5a() = run { class Local Local() } My(invalid5a()) -} +} // Valid: effectively Any val valid1 = object {} diff --git a/compiler/testData/diagnostics/tests/exposed/object.fir.kt b/compiler/testData/diagnostics/tests/exposed/object.fir.kt index bb691f70370..5d9dd183b00 100644 --- a/compiler/testData/diagnostics/tests/exposed/object.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/object.fir.kt @@ -1,7 +1,7 @@ // From KT-10753 object My : Inter() { - fun foo(arg: Inter): Inter = arg - val x: Inter? = null + fun foo(arg: Inter): Inter = arg + val x: Inter? = null } internal open class Inter @@ -10,21 +10,21 @@ internal open class Inter open class Test { protected class Protected - fun foo(x: Protected) = x + fun foo(x: Protected) = x interface NestedInterface { fun create(x: Protected) } class NestedClass { - fun create(x: Protected) = x + fun create(x: Protected) = x } object NestedObject { - fun create(x: Protected) = x + fun create(x: Protected) = x } companion object { - fun create(x: Protected) = x + fun create(x: Protected) = x } } diff --git a/compiler/testData/diagnostics/tests/exposed/propertyInPrivateConstructor.fir.kt b/compiler/testData/diagnostics/tests/exposed/propertyInPrivateConstructor.fir.kt index 69728dd4204..b4c6e1e296d 100644 --- a/compiler/testData/diagnostics/tests/exposed/propertyInPrivateConstructor.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/propertyInPrivateConstructor.fir.kt @@ -1,3 +1,3 @@ private enum class Foo { A, B } -class Bar private constructor(val foo: Foo) \ No newline at end of file +class Bar private constructor(val foo: Foo) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/exposed/propertyInSimpleConstructor.fir.kt b/compiler/testData/diagnostics/tests/exposed/propertyInSimpleConstructor.fir.kt index e3a6b5a90dc..fba4dc687d6 100644 --- a/compiler/testData/diagnostics/tests/exposed/propertyInSimpleConstructor.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/propertyInSimpleConstructor.fir.kt @@ -1,3 +1,3 @@ private enum class Foo { A, B } -class Bar(val foo: Foo) \ No newline at end of file +class Bar(val foo: Foo) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/exposed/protectedJava.fir.kt b/compiler/testData/diagnostics/tests/exposed/protectedJava.fir.kt index 6b66983edd8..7dc16417a2e 100644 --- a/compiler/testData/diagnostics/tests/exposed/protectedJava.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/protectedJava.fir.kt @@ -12,5 +12,5 @@ class OuterDerived: Outer() { // valid, My has better visibility protected class His: Outer.My() // valid, My and Your have better visibility - override fun foo(my: Outer.My) = Outer.Your() + 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 22f4c044972..6a0cc23ebf3 100644 --- a/compiler/testData/diagnostics/tests/exposed/protectedSameWay.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/protectedSameWay.fir.kt @@ -9,5 +9,5 @@ class OuterDerived: Outer() { // valid, My has better visibility protected class His: Outer.My() // valid, My and Your have better visibility - override fun foo(my: Outer.My) = Outer.Your() + 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 4a7ac92888e..c8d98b7ea25 100644 --- a/compiler/testData/diagnostics/tests/exposed/simple.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/simple.fir.kt @@ -6,18 +6,18 @@ 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) - val y: Base? = null + val y: Base? = null val My.z: Int get() = 42 - fun foo(m: My): My = m + fun foo(m: My): My = m - fun My.bar(): My = this + fun My.bar(): My = this } diff --git a/compiler/testData/diagnostics/tests/exposed/typeArgs.fir.kt b/compiler/testData/diagnostics/tests/exposed/typeArgs.fir.kt index 6bfd8cd3ccc..4331ca30370 100644 --- a/compiler/testData/diagnostics/tests/exposed/typeArgs.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/typeArgs.fir.kt @@ -2,7 +2,7 @@ internal open class My abstract class Your { // invalid, List is effectively internal - abstract fun give(): List + abstract fun give(): List } // invalid, List is effectively internal diff --git a/compiler/testData/diagnostics/tests/imports/ImportPrivateMembersWithStar.fir.kt b/compiler/testData/diagnostics/tests/imports/ImportPrivateMembersWithStar.fir.kt index ec73fd79753..ca8d7b91a77 100644 --- a/compiler/testData/diagnostics/tests/imports/ImportPrivateMembersWithStar.fir.kt +++ b/compiler/testData/diagnostics/tests/imports/ImportPrivateMembersWithStar.fir.kt @@ -16,7 +16,7 @@ private class TopLevelClass { } } -private enum class TopLevelEnum(private val e: NestedEnum) { +private enum class TopLevelEnum(private val e: NestedEnum) { E1(NestedEntry); private enum class NestedEnum { diff --git a/compiler/testData/diagnostics/tests/imports/ImportProtectedClass.fir.kt b/compiler/testData/diagnostics/tests/imports/ImportProtectedClass.fir.kt index fbaab487350..4c48bbf90f5 100644 --- a/compiler/testData/diagnostics/tests/imports/ImportProtectedClass.fir.kt +++ b/compiler/testData/diagnostics/tests/imports/ImportProtectedClass.fir.kt @@ -7,7 +7,7 @@ open class Foo { } class Bar: Foo() { - protected fun foo(): Nested? = null + protected fun foo(): Nested? = null } private fun foo(): Nested? = null diff --git a/compiler/testData/diagnostics/tests/imports/InaccessiblePrivateClass.fir.kt b/compiler/testData/diagnostics/tests/imports/InaccessiblePrivateClass.fir.kt index eb4afc7de1d..cc97cecd2eb 100644 --- a/compiler/testData/diagnostics/tests/imports/InaccessiblePrivateClass.fir.kt +++ b/compiler/testData/diagnostics/tests/imports/InaccessiblePrivateClass.fir.kt @@ -14,5 +14,5 @@ package p1 import p2.* -val x: X = X() -val y: Y = Y() +val x: X = X() +val y: Y = Y() diff --git a/compiler/testData/diagnostics/tests/j+k/packageVisibility.fir.kt b/compiler/testData/diagnostics/tests/j+k/packageVisibility.fir.kt index 15cd2edd5cd..31f7c726aad 100644 --- a/compiler/testData/diagnostics/tests/j+k/packageVisibility.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/packageVisibility.fir.kt @@ -16,10 +16,10 @@ class MyJavaClass { //FILE:a.kt package a -val mc = MyJavaClass() +val mc = MyJavaClass() val x = MyJavaClass.staticMethod() val y = MyJavaClass.NestedClass.staticMethodOfNested() -val z = MyJavaClass.NestedClass() +val z = MyJavaClass.NestedClass() //FILE: b.kt package b diff --git a/compiler/testData/diagnostics/tests/privateInFile/visibility.fir.kt b/compiler/testData/diagnostics/tests/privateInFile/visibility.fir.kt index c4c4f8bbe61..e238dd90988 100644 --- a/compiler/testData/diagnostics/tests/privateInFile/visibility.fir.kt +++ b/compiler/testData/diagnostics/tests/privateInFile/visibility.fir.kt @@ -20,7 +20,7 @@ private fun bar() { xx = 30 } -fun makeA() = A() +fun makeA() = A() private object PO {} diff --git a/compiler/testData/diagnostics/tests/resolve/constructorVsCompanion.fir.kt b/compiler/testData/diagnostics/tests/resolve/constructorVsCompanion.fir.kt index 104e9df987a..4e5e8b3754d 100644 --- a/compiler/testData/diagnostics/tests/resolve/constructorVsCompanion.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/constructorVsCompanion.fir.kt @@ -17,7 +17,7 @@ class E private constructor() { } val a = A -val b = B +val b = B val c = C val d = D val e = E(42) diff --git a/compiler/testData/diagnostics/tests/scopes/visibility2.fir.kt b/compiler/testData/diagnostics/tests/scopes/visibility2.fir.kt index a6db2e99377..96f7aa08eb6 100644 --- a/compiler/testData/diagnostics/tests/scopes/visibility2.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/visibility2.fir.kt @@ -9,7 +9,7 @@ private open class A { private fun foo() {} -fun makeA() = A() +fun makeA() = A() private object PO {} diff --git a/compiler/testData/diagnostics/tests/scopes/visibility3.fir.kt b/compiler/testData/diagnostics/tests/scopes/visibility3.fir.kt index 1706bfbd9bf..4f910489c7f 100644 --- a/compiler/testData/diagnostics/tests/scopes/visibility3.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/visibility3.fir.kt @@ -16,7 +16,7 @@ private fun bar() { x = 20 } -fun makeA() = A() +fun makeA() = A() private object PO {} diff --git a/compiler/testData/diagnostics/tests/subtyping/nestedIntoLocalClasses.fir.kt b/compiler/testData/diagnostics/tests/subtyping/nestedIntoLocalClasses.fir.kt index 8f8136a0d50..105a61d60c1 100644 --- a/compiler/testData/diagnostics/tests/subtyping/nestedIntoLocalClasses.fir.kt +++ b/compiler/testData/diagnostics/tests/subtyping/nestedIntoLocalClasses.fir.kt @@ -6,14 +6,14 @@ package p private fun foo(a: Int) = run { object { inner class A - fun foo() = A() + fun foo() = A() }.foo() } private fun foo() = run { object { inner class A - fun foo() = A() + fun foo() = A() }.foo() } diff --git a/compiler/testData/diagnostics/tests/typealias/exposedExpandedType.fir.kt b/compiler/testData/diagnostics/tests/typealias/exposedExpandedType.fir.kt index 56b7b670c55..a7da9744b31 100644 --- a/compiler/testData/diagnostics/tests/typealias/exposedExpandedType.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/exposedExpandedType.fir.kt @@ -7,39 +7,39 @@ class Outer { protected class Protected internal class Internal - typealias TestPrivate1 = Private - protected typealias TestPrivate2 = Private - internal typealias TestPrivate3 = Private + typealias TestPrivate1 = Private + protected typealias TestPrivate2 = Private + internal typealias TestPrivate3 = Private private typealias TestPrivate4 = Private - typealias TestPrivate5 = L + typealias TestPrivate5 = L typealias TestPrivate6 = L - typealias TestProtected1 = Protected + typealias TestProtected1 = Protected protected typealias TestProtected2 = Protected - internal typealias TestProtected3 = Protected + internal typealias TestProtected3 = Protected private typealias TestProtected4 = Protected - typealias TestProtected5 = L + typealias TestProtected5 = L typealias TestProtected6 = L - typealias TestInternal1 = Internal - protected typealias TestInternal2 = Internal + typealias TestInternal1 = Internal + protected typealias TestInternal2 = Internal internal typealias TestInternal3 = Internal private typealias TestInternal4 = Internal - typealias TestInternal5 = L + typealias TestInternal5 = L typealias TestInternal6 = L } private class Private internal class Internal -typealias TestPrivate1 = Private -internal typealias TestPrivate2 = Private +typealias TestPrivate1 = Private +internal typealias TestPrivate2 = Private private typealias TestPrivate3 = Private -typealias TestPrivate4 = L +typealias TestPrivate4 = L typealias TestPrivate5 = L -typealias TestInternal1 = Internal +typealias TestInternal1 = Internal internal typealias TestInternal2 = Internal private typealias TestInternal3 = Internal -typealias TestInternal4 = L +typealias TestInternal4 = L typealias TestInternal5 = L diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasInvisibleObject.fir.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasInvisibleObject.fir.kt index 07b285f70a5..1fffd688b40 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasInvisibleObject.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasInvisibleObject.fir.kt @@ -4,5 +4,5 @@ class C { typealias CAlias = C -val test1 = CAlias -val test1a = C \ No newline at end of file +val test1 = CAlias +val test1a = C \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/InaccessibleInternalClass.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/InaccessibleInternalClass.fir.kt index a0aa3a86ea5..55ad0bf66d9 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/InaccessibleInternalClass.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/InaccessibleInternalClass.fir.kt @@ -10,6 +10,6 @@ package kotlin.sequences import p.* interface I { - val v1: FilteringSequence - val v2: IndexingSequence + val v1: FilteringSequence + val v2: IndexingSequence }