Can be private: correct detection of calls inside inline function
So #KT-22180 Fixed So #KT-22094 Fixed
This commit is contained in:
+1
-1
@@ -131,7 +131,7 @@ class MemberVisibilityCanBePrivateInspection : AbstractKotlinInspection() {
|
||||
return@Processor false
|
||||
}
|
||||
}
|
||||
val function = usage.getParentOfType<KtCallableDeclaration>(false)
|
||||
val function = usage.getParentOfType<KtNamedFunction>(true)
|
||||
val insideInlineFun = function?.modifierList?.let { it.hasModifier(KtTokens.INLINE_KEYWORD) && !function.isPrivate() } ?: false
|
||||
if (insideInlineFun) {
|
||||
otherUsageFound = true
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
open class AA {
|
||||
protected inline fun foo() {
|
||||
val result = bar()
|
||||
}
|
||||
protected fun bar() {
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> run(f: () -> T): T = f()
|
||||
|
||||
object TT {
|
||||
inline fun foo(f: () -> String) {
|
||||
run {
|
||||
bar(f())
|
||||
}
|
||||
}
|
||||
|
||||
fun bar(s: String) = s
|
||||
}
|
||||
Reference in New Issue
Block a user