boolean (@NotNull GrCallExpression call) { PsiElement parent = call.getParent(); if (!(parent instanceof GrVariableDeclarationOwner owner)) { return true; } // tail calls in methods and closures if (owner instanceof GrClosableBlock || owner instanceof GrOpenBlock && owner.getParent() instanceof GrMethod) { GrStatement[] statements = ((GrCodeBlock) owner).getStatements(); assert statements.length > 0; GrStatement last = statements[statements.length - 1]; if (last == call) return true; if (last instanceof GrReturnStatement && call == ((GrReturnStatement) last).getReturnValue()) { return true; } } return false; }