PsiTypeElement () { for (PsiElement child = getFirstChild(); child != null; child = child.getNextSibling()) { if (child instanceof PsiTypeElement) return (PsiTypeElement)child; if (child instanceof PsiPatternVariable) return ((PsiPatternVariable)child).getTypeElement(); } throw new IllegalStateException(this.getText()); }