@Override
  public @NotNull PsiType getType() throws TypeSyntaxException, NoTypeException {
    class MyTypeSyntaxException extends RuntimeException {
      final PsiErrorElement error;

      MyTypeSyntaxException(PsiErrorElement e) {
        super(e.getErrorDescription());
        error = e;
      }
    }

    try {
      accept(new PsiRecursiveElementWalkingVisitor() {
        @Override
        public void visitErrorElement(@NotNull PsiErrorElement element) {
          throw new MyTypeSyntaxException(element);
        }
      });
    }
    catch (MyTypeSyntaxException e) {
      throw new TypeSyntaxException(e.getMessage(), e.error.getTextRange().getStartOffset());
    }

    final PsiTypeElement typeElement = PsiTreeUtil.getChildOfType(this, PsiTypeElement.class);
    if (typeElement == null) {
      throw new NoTypeException("No type found in '" + getText() + "'");
    }

    final PsiType type = typeElement.getType();
    if (type instanceof PsiEllipsisType && !myAllowEllipsis) {
      throw new TypeSyntaxException("Ellipsis not allowed: " + type);
    }
    else if (type instanceof PsiDisjunctionType && !myAllowDisjunction) {
      throw new TypeSyntaxException("Disjunction not allowed: " + type);
    }
    else if (type instanceof PsiIntersectionType && !myAllowConjunction) {
      throw new TypeSyntaxException("Conjunction not allowed: " + type);
    }
    return type;
  }
@Override
  public @NotNull PsiType getType()