                  (cons filename linum)))))
           (candidates
            (merlin-sync-to-point)
-           (mapcar #'(lambda (x) (propertize (car x) 'merlin-meta (cadr x)))
+           (mapcar #'(lambda (x)
+                       (propertize
+                         (propertize (cdr (assoc 'name x))
+                                     'merlin-meta
+                                     (merlin--completion-format-entry x))
+                         'merlin-arg-type
+                         (cdr (assoc 'argument_type x))))
                    (merlin--completion-data arg)))
           (post-completion
             (let ((minibuffer-message-timeout nil))
               (minibuffer-message "%s : %s" arg (get-text-property 0 'merlin-meta arg))))
           (meta
-           (get-text-property 0 'merlin-meta arg))
+            (let ((arg-type (get-text-property 0 'merlin-arg-type arg))
+                  (entry-ty (get-text-property 0 'merlin-meta arg)))
+              (if (and merlin-completion-arg-type arg-type)
+                (concat "Expected argument type: " arg-type)
+                entry-ty)))
           (annotation
            (concat " : " (get-text-property 0 'merlin-meta arg)))
           )))

                                        (aset name 0 ?~)
                                        (string-prefix-p suffix name)))))
                              labels))
  ; Format labels
  (mapcar (lambda (x) (list (cdr (assoc 'name x)) (cdr (assoc 'type x)) "Label" nil))
          labels))

(defun merlin--completion-data (ident)
  "Return the data for completion of IDENT, i.e. a list of pairs (NAME . TYPE)."

      (setq data (merlin-send-command `(expand prefix ,ident at ,pos)))
      (setq entries (cdr (assoc 'entries data)))
      (setq prefix ""))
    ; Concat results
    (let ((result (append labels entries)))
      (if expected-ty
        (mapcar (lambda (x) (append x `((argument_type . ,expected-ty))))
                result)
        result))))

; Here for backward compatibility: this function is called by external code, the
; format of merlin--completion-data changed, this function translates it back to
; the old format.
(defun merlin-completion-data (ident)
  "Backward compatible version of merlin--completion-data"
  (let (entries (merlin--completion-data ident))
    (mapcar (lambda (entry)
              (list (concat prefix (cdr (assoc 'name entry)))
                    (merlin--completion-format-entry entry)
                    (cdr (assoc 'kind entry))
                    (cdr (assoc 'info entry))))
            entries)))

(defun merlin--completion-lookup (string state)
  "Lookup the entry STRING inside the completion table."
