diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/MyException.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/MyException.kt index 7a3c32ff4a0..4a6b4a76287 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/MyException.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/MyException.kt @@ -15,7 +15,7 @@ fun test(e: MyException, stream: PrintStream) { val result = e.getLocalizedMessage() } -fun test(e: YourException, stream: PrintStream) { +fun test(e: YourException, stream: PrintStream) { e.printStackTrace() e.printStackTrace(stream) val result = e.getLocalizedMessage() 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 872e021c69d..b8e0d393a8f 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 @@ -6,14 +6,12 @@ package org.jetbrains.kotlin.fir.analysis.checkers.declaration import com.intellij.psi.PsiElement -import org.jetbrains.kotlin.diagnostics.DiagnosticFactory3 import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext 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.analysis.diagnostics.onSource 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 @@ -111,8 +109,8 @@ object FirExposedVisibilityChecker : FirDeclarationChecker } } - private inline fun DiagnosticReporter.reportExposure( - error: DiagnosticFactory3, + private inline fun DiagnosticReporter.reportExposure( + error: FirDiagnosticFactory3, restrictingDeclaration: DeclarationWithRelation, elementVisibility: FirEffectiveVisibility, restrictingVisibility: FirEffectiveVisibility, @@ -120,8 +118,8 @@ object FirExposedVisibilityChecker : FirDeclarationChecker ) { source?.let { report( - error.onSource( - it, + error.on( + it as E, elementVisibility, restrictingDeclaration, restrictingVisibility diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt index 419c1d5bbfb..895a9ff55f9 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt @@ -71,5 +71,6 @@ class FirDefaultErrorMessages : DefaultErrorMessages.Extension { map.put(EXPOSED_FUNCTION_RETURN_TYPE, "{0} function exposes its {2} return type{1}", TO_STRING, TO_STRING, TO_STRING) map.put(EXPOSED_RECEIVER_TYPE, "{0} member exposes its {2} receiver type{1}", TO_STRING, TO_STRING, TO_STRING) map.put(EXPOSED_PARAMETER_TYPE, "{0} function exposes its {2} parameter type{1}", TO_STRING, TO_STRING, TO_STRING) + } } } 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 b8de3be0414..a656de9e22b 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 @@ -14,6 +14,8 @@ import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol 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.KtTypeReference object FirErrors { val UNRESOLVED_REFERENCE by error1() @@ -49,11 +51,11 @@ object FirErrors { val NON_PRIVATE_CONSTRUCTOR_IN_SEALED by existing(Errors.NON_PRIVATE_CONSTRUCTOR_IN_SEALED) // Exposed visibility group - val EXPOSED_TYPEALIAS_EXPANDED_TYPE by error3() - val EXPOSED_FUNCTION_RETURN_TYPE by error3() - val EXPOSED_RECEIVER_TYPE by error3() - val EXPOSED_PROPERTY_TYPE by error3() - val EXPOSED_PARAMETER_TYPE by error3() + val EXPOSED_TYPEALIAS_EXPANDED_TYPE by error3() + val EXPOSED_FUNCTION_RETURN_TYPE by error3() + val EXPOSED_RECEIVER_TYPE by error3() + val EXPOSED_PROPERTY_TYPE by error3() + val EXPOSED_PARAMETER_TYPE 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 5b7c5143632..35c710c83cb 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirEffectiveVisibilityUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirEffectiveVisibilityUtils.kt @@ -10,6 +10,8 @@ import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.descriptors.Visibility import org.jetbrains.kotlin.fir.FirEffectiveVisibility.* import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.resolve.declaredMemberScopeProvider +import org.jetbrains.kotlin.fir.resolve.firProvider import org.jetbrains.kotlin.fir.resolve.firSymbolProvider import org.jetbrains.kotlin.fir.resolve.toSymbol import org.jetbrains.kotlin.fir.types.ConeClassLikeType @@ -34,14 +36,27 @@ fun ConeKotlinType.leastPermissiveDescriptor(session: FirSession, base: FirEffec fun FirMemberDeclaration.firEffectiveVisibility( session: FirSession, visibility: Visibility = this.visibility, checkPublishedApi: Boolean = false -): FirEffectiveVisibility = - lowerBound( +): FirEffectiveVisibility { + val containing = this.containingClass(session) + return lowerBound( visibility.firEffectiveVisibility(session, this), - this.containingClass(session)?.firEffectiveVisibility(session, checkPublishedApi) ?: Public + this.effectiveVisibility, + containing?.firEffectiveVisibility(session, checkPublishedApi) ?: Public, + containing?.effectiveVisibility ?: Public ) +} -private fun lowerBound(first: FirEffectiveVisibility, second: FirEffectiveVisibility) = - first.lowerBound(second) + +private fun lowerBound(vararg elements: FirEffectiveVisibility): FirEffectiveVisibility { + if (elements.size < 2) { + throw IllegalArgumentException("Number of elements must be greater than 1") + } + var result = elements[0] + for (el in elements) { + result = result.lowerBound(el) + } + return result +} private fun FirMemberDeclaration.containingClass(session: FirSession): FirRegularClass? { val classId = when (this) { @@ -50,7 +65,9 @@ private fun FirMemberDeclaration.containingClass(session: FirSession): FirRegula else -> null } ?: return null if (classId.isLocal) return null - return session.firSymbolProvider.getClassLikeSymbolByFqName(classId)?.fir as? FirRegularClass + val buffer = session.declaredMemberScopeProvider.getClassByClassId(classId) + return (session.firSymbolProvider.getClassLikeSymbolByFqName(classId)?.fir as? FirRegularClass) + ?: (session.declaredMemberScopeProvider.getClassByClassId(classId) as? FirRegularClass) } private fun Visibility.forVisibility( @@ -63,7 +80,8 @@ private fun Visibility.forVisibility( Visibilities.PUBLIC -> Public Visibilities.LOCAL -> Local // NB: visibility must be already normalized here, so e.g. no JavaVisibilities are possible at this point - else -> throw AssertionError("Visibility $name is not allowed in forVisibility") + // TODO: else -> throw AssertionError("Visibility $name is not allowed in forVisibility") + else -> Private } class DeclarationWithRelation internal constructor(val declaration: FirMemberDeclaration, private val relation: RelationToType) { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirDeclaredMemberScopeProvider.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirDeclaredMemberScopeProvider.kt index 94451ee5a32..2d3785221b0 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirDeclaredMemberScopeProvider.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirDeclaredMemberScopeProvider.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.scopes.impl import org.jetbrains.kotlin.fir.FirSessionComponent import org.jetbrains.kotlin.fir.declarations.FirClass +import org.jetbrains.kotlin.fir.declarations.classId import org.jetbrains.kotlin.fir.resolve.FirSymbolProvider import org.jetbrains.kotlin.fir.resolve.declaredMemberScopeProvider import org.jetbrains.kotlin.fir.scopes.FirScope @@ -18,6 +19,24 @@ class FirDeclaredMemberScopeProvider : FirSessionComponent { private val declaredMemberCache = mutableMapOf, FirScope>() private val nestedClassifierCache = mutableMapOf, FirNestedClassifierScope>() + fun getClassByClassId(classId: ClassId): FirClass<*>? { + for ((clazz, _) in declaredMemberCache) { + if (clazz.classId.packageFqName == classId.packageFqName + && clazz.classId.relativeClassName == classId.relativeClassName + ) { + return clazz + } + } + for ((clazz, _) in nestedClassifierCache) { + if (clazz.classId.packageFqName == classId.packageFqName + && clazz.classId.relativeClassName == classId.relativeClassName + ) { + return clazz + } + } + return null + } + fun declaredMemberScope( klass: FirClass<*>, useLazyNestedClassifierScope: Boolean, diff --git a/compiler/testData/diagnostics/tests/enum/classObjectInEnumPrivate.fir.kt b/compiler/testData/diagnostics/tests/enum/classObjectInEnumPrivate.fir.kt index e74ba426a8a..464369fd915 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 index 6b49dbee9bf..f84e5e67306 100644 --- a/compiler/testData/diagnostics/tests/exposed/functional.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/functional.fir.kt @@ -3,10 +3,10 @@ internal class My class Your // Both arguments should be exposed -fun foo(my: My, f: (My) -> Unit) = f(my) +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 +fun gav(f: () -> My) = f() \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/exposed/internal.fir.kt b/compiler/testData/diagnostics/tests/exposed/internal.fir.kt index e098b640ce4..4ebccb7479f 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 index 6becf4d98cb..5059138800c 100644 --- a/compiler/testData/diagnostics/tests/exposed/internalFromLocal.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/internalFromLocal.fir.kt @@ -3,8 +3,8 @@ interface Your class My { internal val x = object : Your {} - internal fun foo() = { + internal fun foo() = { class Local Local() - }() + }() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/exposed/local.fir.kt b/compiler/testData/diagnostics/tests/exposed/local.fir.kt index 7d6e06dbfea..e3a36a81fb9 100644 --- a/compiler/testData/diagnostics/tests/exposed/local.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/local.fir.kt @@ -1,14 +1,14 @@ // invalid, depends on local class -fun foo() = run { +fun foo() = run { class A A() -} +} // invalid, depends on local class -fun gav() = { +fun gav() = { class B B() -} +} abstract class My diff --git a/compiler/testData/diagnostics/tests/exposed/localInFunReturnType.fir.kt b/compiler/testData/diagnostics/tests/exposed/localInFunReturnType.fir.kt index c37928f2317..d3134ef52de 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 index 8bc8f6a0ca0..a496ac3b54f 100644 --- a/compiler/testData/diagnostics/tests/exposed/localInMemberType.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/localInMemberType.fir.kt @@ -4,9 +4,9 @@ class Something { 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() } + 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() = "!" } @@ -14,8 +14,8 @@ class Something { 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() } + 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/localInPropertyType.fir.kt b/compiler/testData/diagnostics/tests/exposed/localInPropertyType.fir.kt index ca2fbd3d9fc..55b74852bdb 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 ec72d2bbd68..bb691f70370 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) + 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 59754a5f667..69728dd4204 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 b93fcfa3b98..e3a6b5a90dc 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/simple.fir.kt b/compiler/testData/diagnostics/tests/exposed/simple.fir.kt index 72ec119da23..4a7ac92888e 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) + constructor(xx: My?, x: My): this(xx ?: x) - val y: Base? = null + val y: Base? = null - val My.z: Int + 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 ff682fb7c35..6bfd8cd3ccc 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 ca8d7b91a77..ec73fd79753 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 bad5d7c283b..fbaab487350 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 5a7a9668d1a..eb4afc7de1d 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/inline/nonPublicMember/publishedApi.fir.kt b/compiler/testData/diagnostics/tests/inline/nonPublicMember/publishedApi.fir.kt index 0848d0d9506..256104c9f47 100644 --- a/compiler/testData/diagnostics/tests/inline/nonPublicMember/publishedApi.fir.kt +++ b/compiler/testData/diagnostics/tests/inline/nonPublicMember/publishedApi.fir.kt @@ -1,7 +1,7 @@ // !DIAGNOSTICS: -EXPOSED_PARAMETER_TYPE -NOTHING_TO_INLINE -inline fun call(a: A) { +inline fun call(a: A) { a.test() privateFun() diff --git a/compiler/testData/diagnostics/tests/inline/privateClass.fir.kt b/compiler/testData/diagnostics/tests/inline/privateClass.fir.kt index 34c743b800b..6c1705a771c 100644 --- a/compiler/testData/diagnostics/tests/inline/privateClass.fir.kt +++ b/compiler/testData/diagnostics/tests/inline/privateClass.fir.kt @@ -6,7 +6,7 @@ private class S public constructor() { } } -internal inline fun x(s: S, z: () -> Unit) { +internal inline fun x(s: S, z: () -> Unit) { z() S() s.a() diff --git a/compiler/testData/diagnostics/tests/inline/publishedApi.fir.kt b/compiler/testData/diagnostics/tests/inline/publishedApi.fir.kt index ad214321f3a..710e5f7d9ee 100644 --- a/compiler/testData/diagnostics/tests/inline/publishedApi.fir.kt +++ b/compiler/testData/diagnostics/tests/inline/publishedApi.fir.kt @@ -1,5 +1,5 @@ // !DIAGNOSTICS: -EXPOSED_PARAMETER_TYPE -NOTHING_TO_INLINE -inline fun call(a: A) { +inline fun call(a: A) { a.test() publishedTopLevel() diff --git a/compiler/testData/diagnostics/tests/j+k/packageVisibility.fir.kt b/compiler/testData/diagnostics/tests/j+k/packageVisibility.fir.kt index ff2aed7313b..15cd2edd5cd 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 fdb9710d13b..c4c4f8bbe61 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 6e45eab1c78..104e9df987a 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 e17a0496bd2..a6db2e99377 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 cfcf09a19a4..1706bfbd9bf 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 bcd2f8e1689..8f8136a0d50 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 2b9ab13235f..56b7b670c55 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 d11df54d662..07b285f70a5 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 66c2c487bc3..a0aa3a86ea5 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 }