Can be private: correct detection of calls inside inline accessors
This commit is contained in:
+4
-2
@@ -131,8 +131,10 @@ class MemberVisibilityCanBePrivateInspection : AbstractKotlinInspection() {
|
||||
return@Processor false
|
||||
}
|
||||
}
|
||||
val function = usage.getParentOfType<KtNamedFunction>(true)
|
||||
val insideInlineFun = function?.modifierList?.let { it.hasModifier(KtTokens.INLINE_KEYWORD) && !function.isPrivate() } ?: false
|
||||
val function = usage.getParentOfTypesAndPredicate<KtDeclarationWithBody>(
|
||||
true, KtNamedFunction::class.java, KtPropertyAccessor::class.java
|
||||
) { true }
|
||||
val insideInlineFun = function?.let { it.hasModifier(KtTokens.INLINE_KEYWORD) && !function.isPrivate() } ?: false
|
||||
if (insideInlineFun) {
|
||||
otherUsageFound = true
|
||||
false
|
||||
|
||||
@@ -15,5 +15,10 @@ object TT {
|
||||
}
|
||||
}
|
||||
|
||||
val x: String
|
||||
inline get() = baz
|
||||
|
||||
fun bar(s: String) = s
|
||||
|
||||
val baz = ""
|
||||
}
|
||||
Reference in New Issue
Block a user