mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
[kotlin] Remove useless check for android DSL
KTIJ-28468 kotlinOptions to compilerOptions inspection (kts only) Deleted check didn't stop the visitor from visiting enclosed references. `kotlinOptions` inside `android` has the type `org.gradle.kotlin.dsl.kotlinOptions` and won't pass the inspection check for allowed for replacement `kotlinOptions` types GitOrigin-RevId: 492eb0708da548a7e14d3057ca9e40058acb4f09
This commit is contained in:
committed by
intellij-monorepo-bot
parent
246027b550
commit
0f4e01f660
@@ -61,10 +61,6 @@ internal class KotlinOptionsToCompilerOptionsInGradleScriptInspection : Abstract
|
||||
return object : KtVisitorVoid() {
|
||||
override fun visitReferenceExpression(expression: KtReferenceExpression) {
|
||||
val referencedName = (expression as? KtNameReferenceExpression)?.getReferencedName() ?: return
|
||||
// ATM, we don't have proper dependencies for tests to perform `analyze` in Gradle build scripts
|
||||
if (referencedName == "android" && !isUnitTestMode()) {
|
||||
if (elementIsAndroidDsl(expression)) return
|
||||
}
|
||||
if (referencedName != "kotlinOptions") return
|
||||
|
||||
val expressionParent = expression.parent
|
||||
@@ -139,17 +135,6 @@ internal class KotlinOptionsToCompilerOptionsInGradleScriptInspection : Abstract
|
||||
}
|
||||
}
|
||||
|
||||
private fun elementIsAndroidDsl(expression: KtExpression): Boolean {
|
||||
val importableFqName = analyze(expression) {
|
||||
val symbol = expression.resolveToCall()
|
||||
?.successfulFunctionCallOrNull()?.partiallyAppliedSymbol?.signature?.symbol
|
||||
val kaSymbol =
|
||||
(symbol?.containingDeclaration as? KaClassLikeSymbol) ?: expression.resolveExpression()
|
||||
kaSymbol?.importableFqName?.toString()
|
||||
}
|
||||
return importableFqName == "org.gradle.kotlin.dsl.android"
|
||||
}
|
||||
|
||||
private fun expressionsContainForbiddenOperations(element: PsiElement): Boolean {
|
||||
if (element is KtBinaryExpression) { // for sth like `kotlinOptions.sourceMapEmbedSources = "inlining"`
|
||||
if (expressionContainsOperationForbiddenToReplace(element)) return true
|
||||
|
||||
Reference in New Issue
Block a user