Introduce error for PROTECTED_CONSTRUCTOR_CALL_FROM_PUBLIC_INLINE

^KT-42972 Fixed
This commit is contained in:
Victor Petukhov
2021-09-22 12:15:06 +03:00
parent 01e853fb9b
commit 561ef5947a
11 changed files with 89 additions and 5 deletions
@@ -0,0 +1,19 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !LANGUAGE: -ProhibitProtectedConstructorCallFromPublicInline
class SomeContainer {
protected class Limit
protected fun makeLimit(): Limit = TODO()
public inline fun foo(f: () -> Unit) {
<!PROTECTED_CONSTRUCTOR_CALL_FROM_PUBLIC_INLINE_WARNING!>Limit<!>()
<!PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR!>makeLimit<!>()
}
}
open class A protected constructor() {
inline fun foo(f: () -> Unit) {
<!PROTECTED_CONSTRUCTOR_CALL_FROM_PUBLIC_INLINE_WARNING!>A<!>()
}
}