mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[kotlin] k2 unused symbol: use the correct session to analyze usages
^KTIJ-34457 fixed GitOrigin-RevId: fed14af2b01053816639e54b2125596cf00772b1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
fb613ad51e
commit
f23ca8f7e4
+4
-3
@@ -419,7 +419,7 @@ object K2UnusedSymbolUtil {
|
||||
|
||||
if (declaration is KtEnumEntry) {
|
||||
val enumClass = declarationContainingClass?.takeIf { it.isEnum() }
|
||||
if (hasBuiltInEnumFunctionReference(enumClass, useScope, declaration)) return true
|
||||
if (hasBuiltInEnumFunctionReference(enumClass, useScope)) return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -493,10 +493,11 @@ object K2UnusedSymbolUtil {
|
||||
}
|
||||
|
||||
context(KaSession)
|
||||
private fun hasBuiltInEnumFunctionReference(enumClass: KtClass?, useScope: SearchScope, declaration: KtNamedDeclaration): Boolean {
|
||||
private fun hasBuiltInEnumFunctionReference(enumClass: KtClass?, useScope: SearchScope): Boolean {
|
||||
if (enumClass == null) return false
|
||||
val isFoundEnumFunctionReferenceViaSearch = referenceExists(enumClass, useScope) {
|
||||
analyze(declaration) {
|
||||
val ktElement = it.element as? KtElement ?: return@referenceExists false
|
||||
analyze(ktElement) {
|
||||
hasBuiltInEnumFunctionReference(it, enumClass)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user