K1: add deprecation for implicit non-public calls #KT-54762 Fixed

This commit is contained in:
Mikhail Glukhikh
2022-11-15 16:40:15 +01:00
committed by Space Team
parent f4b5f5ff5d
commit ac514849f4
10 changed files with 187 additions and 6 deletions
@@ -0,0 +1,42 @@
// !DIAGNOSTICS: -NOTHING_TO_INLINE
@PublishedApi
internal class InternalClassPrivateConstructor private constructor() {
companion object {
internal inline operator fun invoke(): InternalClassPrivateConstructor = InternalClassPrivateConstructor()
internal inline operator fun invoke(i: Int): InternalClassPrivateConstructor = <!RECURSION_IN_INLINE!>InternalClassPrivateConstructor<!>(i)
}
}
private class PrivateClass public constructor() {
operator fun invoke() = 42
}
open class OpenClass {
protected operator fun invoke() = 42
inline fun foo() {
<!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>this<!>()
}
}
@PublishedApi
internal open class InternalClassProtectedConstructor protected constructor() {
companion object {
internal inline operator fun invoke(): InternalClassProtectedConstructor = InternalClassProtectedConstructor()
}
}
inline fun publicInline() {
<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>InternalClassPrivateConstructor<!>()
InternalClassPrivateConstructor.<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>invoke<!>()
<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>InternalClassProtectedConstructor<!>()
}
internal inline fun internalInline() {
val pc = <!PRIVATE_CLASS_MEMBER_FROM_INLINE!>PrivateClass<!>()
<!PRIVATE_CLASS_MEMBER_FROM_INLINE!>pc<!>()
}