PsiType (PsiElement element) { final PsiElement parent = skipParentheses(element.getParent(), true); if (parent instanceof GrAssignmentExpression) { if (element instanceof GrIndexProperty) { final GrExpression rvalue = ((GrAssignmentExpression)parent).getRValue(); return rvalue != null ? rvalue.getType() : null; //don't try to infer assignment type in case of index property because of infinite recursion (example: a[2]+=4) } return ((GrAssignmentExpression)parent).getType(); } if (parent instanceof GrTuple list) { GrTupleAssignmentExpression assignment = list.getParent(); if (assignment != null) { final GrExpression rValue = assignment.getRValue(); if (rValue != null) { int idx = list.indexOf(element); if (idx >= 0) { return getMultiAssignmentType(rValue, idx); } } } } if (parent instanceof GrUnaryExpression unary) { if (TokenSets.POSTFIX_UNARY_OP_SET.contains(unary.getOperationTokenType())) { return unary.getOperationType(); } } return null; }