Suppress K2 specific warnings in the codebase
^KT-62472
This commit is contained in:
committed by
Space Team
parent
9e66a7b999
commit
704e2ef5c5
@@ -34,6 +34,7 @@ abstract class KtExpressionImpl(node: ASTNode) : KtElementImpl(node), KtExpressi
|
||||
if (newElement is KtExpression) {
|
||||
when (parent) {
|
||||
is KtExpression, is KtValueArgument -> {
|
||||
@Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
|
||||
if (KtPsiUtil.areParenthesesNecessary(newElement, expression, parent as KtElement)) {
|
||||
val factory = KtPsiFactory(expression.project)
|
||||
return rawReplaceHandler(factory.createExpressionByPattern("($0)", newElement, reformat = reformat))
|
||||
|
||||
@@ -22,8 +22,10 @@ import org.jetbrains.kotlin.name.Name
|
||||
|
||||
open class KtExpressionWithLabel(node: ASTNode) : KtExpressionImpl(node) {
|
||||
|
||||
fun getTargetLabel(): KtSimpleNameExpression? =
|
||||
labelQualifier?.findChildByType(KtNodeTypes.LABEL) as? KtSimpleNameExpression
|
||||
fun getTargetLabel(): KtSimpleNameExpression? {
|
||||
@Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
|
||||
return labelQualifier?.findChildByType(KtNodeTypes.LABEL) as? KtSimpleNameExpression
|
||||
}
|
||||
|
||||
val labelQualifier: KtContainerNode?
|
||||
get() = findChildByType(KtNodeTypes.LABEL_QUALIFIER)
|
||||
|
||||
@@ -707,6 +707,7 @@ fun getTrailingCommaByElementsList(elementList: PsiElement?): PsiElement? {
|
||||
val KtNameReferenceExpression.isUnderscoreInBackticks
|
||||
get() = getReferencedName() == "`_`"
|
||||
|
||||
@Suppress("NO_TAIL_CALLS_FOUND", "NON_TAIL_RECURSIVE_CALL") // K2 warning suppression, TODO: KT-62472
|
||||
tailrec fun KtTypeElement.unwrapNullability(): KtTypeElement? {
|
||||
return when (this) {
|
||||
is KtNullableType -> this.innerType?.unwrapNullability()
|
||||
|
||||
@@ -201,6 +201,7 @@ inline fun <reified T : PsiElement> PsiElement.getParentOfTypeAndBranches(
|
||||
return getParentOfType<T>(strict)?.getIfChildIsInBranches(this, branches)
|
||||
}
|
||||
|
||||
@Suppress("NO_TAIL_CALLS_FOUND", "NON_TAIL_RECURSIVE_CALL") // K2 warning suppression, TODO: KT-62472
|
||||
tailrec fun PsiElement.getOutermostParentContainedIn(container: PsiElement): PsiElement? {
|
||||
val parent = parent
|
||||
return if (parent == container) this else parent?.getOutermostParentContainedIn(container)
|
||||
|
||||
Reference in New Issue
Block a user