Skip to content

Commit

Permalink
Make ArrayPrimitive rule honor the RequiresTypeResolution annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
BraisGabin committed Aug 3, 2022
1 parent 3bc81d2 commit d8e447f
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -15,6 +15,7 @@ import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtCallExpression
import org.jetbrains.kotlin.psi.KtCallableDeclaration
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtNamedDeclaration
import org.jetbrains.kotlin.psi.KtTypeReference
import org.jetbrains.kotlin.psi.psiUtil.collectDescendantsOfType
Expand Down Expand Up @@ -51,9 +52,13 @@ class ArrayPrimitive(config: Config = Config.empty) : Rule(config) {
Debt.FIVE_MINS
)

override fun visitKtFile(file: KtFile) {
if (bindingContext == BindingContext.EMPTY) return
super.visitKtFile(file)
}

override fun visitCallExpression(expression: KtCallExpression) {
super.visitCallExpression(expression)
if (bindingContext == BindingContext.EMPTY) return
if (expression.calleeExpression?.text !in factoryMethodNames) return

val descriptor = expression.getResolvedCall(bindingContext)?.resultingDescriptor
Expand Down

0 comments on commit d8e447f

Please sign in to comment.