PyType (@NotNull PyExpression boundExpression, @NotNull Context context) { PyExpression bound = PyPsiUtils.flattenParens(boundExpression); if (bound != null) { if (bound instanceof PyTupleExpression tupleExpression) { return StreamEx.of(tupleExpression.getElements()) .map(expr -> Ref.deref(getType(expr, context))) .collect(PyTypeUtil.toUnion()); } else { return Ref.deref(getType(bound, context)); } } return null; }