Do not report "can be private" on properties of private class
So #KT-18822 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
f4d63158cc
commit
848f7423ee
+3
-2
@@ -52,8 +52,9 @@ class MemberVisibilityCanPrivateInspection : AbstractKotlinInspection() {
|
||||
|
||||
override fun visitParameter(parameter: KtParameter) {
|
||||
super.visitParameter(parameter)
|
||||
if (parameter.isConstructorDeclaredProperty() && canBePrivate(parameter)) {
|
||||
registerProblem(holder, parameter)
|
||||
if (parameter.isConstructorDeclaredProperty()) {
|
||||
if ((parameter.ownerFunction?.parent as? KtClass)?.isPrivate() == true) return
|
||||
if (canBePrivate(parameter)) registerProblem(holder, parameter)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,4 +134,18 @@ class F(val bar: Int) {
|
||||
|
||||
class G(val bar: Int) {
|
||||
private inline fun baz() = bar
|
||||
}
|
||||
|
||||
private class H(val a: String = "",
|
||||
var b: String = "",
|
||||
internal val c: String = "",
|
||||
protected val d: String = "",
|
||||
private val e: String = "") {
|
||||
fun foo() {
|
||||
println(a)
|
||||
println(b)
|
||||
println(c)
|
||||
println(d)
|
||||
println(e)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user