FE: fix effective visibility bound calculation logic

#KT-58757 Fixed
#KT-58840 Fixed
This commit is contained in:
Mikhail Glukhikh
2023-05-19 17:42:36 +02:00
committed by Space Team
parent c130786889
commit 2fcd296db8
3 changed files with 6 additions and 15 deletions
@@ -1,10 +0,0 @@
// ISSUE: KT-58757
internal abstract class Foo {
abstract val context: CharSequence
}
internal abstract class Bar(protected val foo: Foo) {
protected inline val inlineContext: String
get() = <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>foo<!>.<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>context<!> as String
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// ISSUE: KT-58757
internal abstract class Foo {
@@ -121,12 +121,12 @@ sealed class EffectiveVisibility(val name: String, val publicApi: Boolean = fals
Public -> this
PrivateInClass, PrivateInFile, Local, ProtectedBound, InternalProtectedBound -> other
is Protected -> when (relation(other, typeCheckerContextProvider)) {
Permissiveness.SAME, Permissiveness.MORE -> this
Permissiveness.LESS -> other
Permissiveness.SAME, Permissiveness.LESS -> this
Permissiveness.MORE -> other
Permissiveness.UNKNOWN -> ProtectedBound
}
is InternalProtected -> when (relation(other, typeCheckerContextProvider)) {
Permissiveness.LESS -> other
Permissiveness.MORE -> other
else -> InternalProtectedBound
}
is InternalOrPackage -> InternalProtected(containerTypeConstructor)
@@ -192,8 +192,8 @@ sealed class EffectiveVisibility(val name: String, val publicApi: Boolean = fals
Public, is InternalOrPackage -> this
PrivateInClass, PrivateInFile, Local, InternalProtectedBound -> other
is Protected, is InternalProtected -> when (relation(other, typeCheckerContextProvider)) {
Permissiveness.SAME, Permissiveness.MORE -> this
Permissiveness.LESS -> other
Permissiveness.SAME, Permissiveness.LESS -> this
Permissiveness.MORE -> other
Permissiveness.UNKNOWN -> InternalProtectedBound
}
ProtectedBound -> InternalProtectedBound