 overlay is displayed and module types are displayed in another
 buffer. Otherwise only value type are displayed, and without
 overlay"
-  (if bounds
-      (let ((result (merlin-type-of-expression bounds
-                                               (buffer-substring-no-properties 
-                                                (car bounds) (cdr bounds)))))
-        (cond
-         ((not (cdr result))
-          (if (not quiet)
-              (message "<no information>"))) ;; no types
-         ((and (not (merlin-is-long (cdr result)))
-               (not quiet))
-          (merlin-create-overlay 'merlin-type-overlay
-                                 (caar result) (cdar result)
-                                 'next-error "1 sec")
-          (message "%s" (cdr result)))
-         ((not (merlin-is-long (cdr result)))
-          (message "%s: %s"
-                   (buffer-substring-no-properties (caar result) (cdar result))
-                   (cdr result)))
-         ((not quiet)
-          (display-buffer merlin-type-buffer)
-          (with-current-buffer merlin-type-buffer
-            (erase-buffer)
-            (insert (cdr result))))))))
+  (let* ((substring (if bounds
+                       (buffer-substring-no-properties (car bounds)
+                                                       (cdr bounds))))
+         (result (merlin-type-of-expression bounds substring)))
+    (cond
+     ((not (cdr result))
+      (if (not quiet)
+          (message "<no information>"))) ;; no types
+     ((and (not (merlin-is-long (cdr result)))
+           (not quiet))
+      (merlin-create-overlay 'merlin-type-overlay
+                             (car result)
+                             'next-error "1 sec")
+      (message "%s" (cdr result)))
+     ((not (merlin-is-long (cdr result)))
+      (message "%s: %s"
+               (buffer-substring-no-properties (caar result) (cdar result))
+               (cdr result)))
+     ((not quiet)
+      (display-buffer merlin-type-buffer)
+      (with-current-buffer merlin-type-buffer
+        (erase-buffer)
+        (insert (cdr result))))))))
   
 
 (defun merlin-show-type-of-region ()


(defun merlin-compute-prefix (ident)
  "Computes the prefix of an identifier. The prefix of Foo.bar is Foo. and the prefix of bar is \"\""
  (let ((l (butlast (split-string ident "\\."))))
    (let ((s (mapconcat 'identity l ".")))
      (if (string-equal s "") s (concat s ".")))))
(defun merlin-make-point (data)
  "Creates a point from a couple line / col"
  (save-excursion

     'bounds-of-ocaml-atom-at-point)

; overlay management
(defun merlin-create-overlay (var bounds face timer)
  "Creates an overlay in the current buffer starting at `start', ending at `end',
using `face' and storing it in `var'. If `timer' is non-nil, the overlay is to disappear after `timer' seconds
`timer' is a string that can be understood by `run-at-time' (eg. \"1 sec\")"
  (if (symbol-value var) (delete-overlay (symbol-value var)))
  (set var (make-overlay (car bounds) (cdr bounds)))
  (overlay-put (symbol-value var) 'face face)
  (if timer
      (run-at-time timer nil `(lambda ()
