Ref<PyType> (@NotNull PyBinaryExpression addition, @NotNull TypeEvalContext context) { if (addition.getRightExpression() != null) { final PyTupleType leftTupleType = as(context.getType(addition.getLeftExpression()), PyTupleType.class); final PyTupleType rightTupleType = as(context.getType(addition.getRightExpression()), PyTupleType.class); if (leftTupleType != null && rightTupleType != null) { if (leftTupleType.isHomogeneous() || rightTupleType.isHomogeneous()) { // We may try to find the common type of elements of two homogeneous tuple as an alternative return null; } final List<PyType> newElementTypes = ContainerUtil.concat(leftTupleType.getElementTypes(), rightTupleType.getElementTypes()); return Ref.create(PyTupleType.create(addition, newElementTypes)); } } return null; }