[kotlin] Add explanation why parenthesis is added after annotated expression

KTIJ-28468 kotlinOptions to compilerOptions inspection (kts only)

GitOrigin-RevId: d2c83f809766e67aaf57b98de27cb7c5dcf1b143
This commit is contained in:
Victoria.Petrakovich
2024-10-03 17:51:26 +00:00
committed by intellij-monorepo-bot
parent 67e0311e32
commit e75f89a4f7
2 changed files with 15 additions and 9 deletions
@@ -20,8 +20,11 @@ tasks.test {
useJUnitPlatform()
}
val compileKotlin: KotlinCompile by tasks
<caret>kotlinOptions {
@Suppress("SuspiciousCollectionReassignment")
freeCompilerArgs += listOf("-Xopt-in=kotlin.RequiresOptIn")
}
tasks.withType<KotlinCompile> {
<caret>kotlinOptions {
@Suppress("SuspiciousCollectionReassignment")
freeCompilerArgs += listOf("-Xopt-in=kotlin.RequiresOptIn")
// KtExpressionImpl performs replaceExpression() and there calls KtPsiUtil.areParenthesesNecessary(). Inside, innerPriority is calculated
// for DOT_QUALIFIED_EXPRESSION and it's 14, parentPriority is calculated for ANNOTATED_EXPRESSION is 15, and that's why () are added
}
}
@@ -20,8 +20,11 @@ tasks.test {
useJUnitPlatform()
}
val compileKotlin: KotlinCompile by tasks
compilerOptions {
@Suppress("SuspiciousCollectionReassignment")
(freeCompilerArgs.addAll(listOf("-Xopt-in=kotlin.RequiresOptIn")))
tasks.withType<KotlinCompile> {
compilerOptions {
@Suppress("SuspiciousCollectionReassignment")
(freeCompilerArgs.addAll(listOf("-Xopt-in=kotlin.RequiresOptIn")))
// KtExpressionImpl performs replaceExpression() and there calls KtPsiUtil.areParenthesesNecessary(). Inside, innerPriority is calculated
// for DOT_QUALIFIED_EXPRESSION and it's 14, parentPriority is calculated for ANNOTATED_EXPRESSION is 15, and that's why () are added
}
}