PsiType (@NotNull PsiType type, @NotNull GrExpression expression) { GrExpression topLevel = expression; while (topLevel.getParent() instanceof GrIndexProperty && ((GrIndexProperty)topLevel.getParent()).getInvokedExpression() == topLevel) { topLevel = (GrExpression)topLevel.getParent(); } PsiType captured = type; if (captured instanceof PsiClassType && !PsiUtil.isAccessedForWriting(topLevel)) { captured = com.intellij.psi.util.PsiUtil.captureToplevelWildcards(type, expression); } return doNormalizeWildcardByPosition(captured, expression, topLevel); }