PyType (@Nullable PyType type, @NotNull TypeEvalContext context) { if (type instanceof PyCallableType) { return ((PyCallableType)type).getReturnType(context); } if (type instanceof PyUnionType) { return PyUnionType.toNonWeakType(((PyUnionType)type).map(member -> getReturnType(member, context))); } return null; }