in src/main/kotlin/org/arend/refactoring/changeSignature/ArendUsageInfo.kt [44:62]
fun isParenthesizedLongName(psi: PsiElement) : Boolean {
if (psi is ArendArgumentAppExpr) {
val parentTuple = psi.ancestor<ArendTupleExpr>()
if (parentTuple == null || parentTuple.textRange != psi.textRange || parentTuple.parent !is ArendTuple || (parentTuple.parent as ArendTuple).tupleExprList.size > 1)
return false
val childTuple = psi.descendantOfType<ArendTuple>()
if (childTuple != null && childTuple.textRange == psi.textRange && childTuple.lparen != null && childTuple.tupleExprList.size == 1) {
val childAppExpr = childTuple.childOfType<ArendArgumentAppExpr>()
if (childAppExpr != null && childAppExpr.textRange == childTuple.textRange) return isParenthesizedLongName(childAppExpr)
}
val atom = psi.descendantOfType<ArendAtom>()
val result = atom != null && atom.textRange == psi.textRange
return result
}
return false
}