camlspotter avatar camlspotter committed ff97ad9 Merge

merge

Comments (0)

Files changed (12)

0patches/0001-better-fix-for-PR-5090.patch

+From 871d4945b9891e2be0d1c944c18eb876fc058c20 Mon Sep 17 00:00:00 2001
+From: doligez <doligez@f963ae5c-01c2-4b8c-9fe0-0dff7051ff02>
+Date: Fri, 13 Aug 2010 13:08:57 +0000
+Subject: [PATCH 1/3] better fix for PR#5090
+
+git-svn-id: http://caml.inria.fr/svn/ocaml/version/3.12@10644 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
+---
+ camlp4/Camlp4/Struct/Grammar/Tools.ml            |   72 ----------------------
+ camlp4/Camlp4Parsers/Camlp4OCamlParser.ml        |    8 ++-
+ camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml |    6 +-
+ camlp4/Camlp4Top/Top.ml                          |   12 +++-
+ 4 files changed, 20 insertions(+), 78 deletions(-)
+
+diff --git a/camlp4/Camlp4/Struct/Grammar/Tools.ml b/camlp4/Camlp4/Struct/Grammar/Tools.ml
+index 4dae7e7..26489d3 100644
+--- a/camlp4/Camlp4/Struct/Grammar/Tools.ml
++++ b/camlp4/Camlp4/Struct/Grammar/Tools.ml
+@@ -16,18 +16,6 @@
+  * - Daniel de Rauglaudre: initial version
+  * - Nicolas Pouillard: refactoring
+  *)
+-
+-(* BEGIN ugly hack.  See 15 lines down.  FIXME *)
+-
+-type prev_locs = {
+-  pl_strm : mutable Obj.t;
+-  pl_locs : mutable list (int * Obj.t)
+-};
+-
+-value prev_locs = ref ([] : list prev_locs);
+-
+-(* END ugly hack FIXME *)
+-
+ module Make (Structure : Structure.S) = struct
+   open Structure;
+ 
+@@ -38,64 +26,6 @@ module Make (Structure : Structure.S) = struct
+     [ [: ` x; strm :] -> [: ` (f x); stream_map f strm :]
+     | [: :] -> [: :] ];
+ 
+-(* ******************************************************************* *)
+-(* Ugly hack to prevent PR#5090.  See how to do this properly after
+-   the 3.12.0 release.  FIXME.
+-*)
+-
+-value keep_prev_loc strm =
+-  match Stream.peek strm with
+-  [ None -> [: :]
+-  | Some (_, init_loc) ->
+-     let myrecord = { pl_strm = Obj.repr [: :];
+-                      pl_locs = [(0, Obj.repr init_loc)] }
+-     in
+-     let rec go prev_loc = parser
+-       [ [: `(tok, cur_loc); strm :] -> do {
+-           myrecord.pl_locs := myrecord.pl_locs
+-                               @ [ (Stream.count strm, Obj.repr cur_loc) ];
+-           [: `(tok, {prev_loc; cur_loc}); go cur_loc strm :] }
+-       | [: :] -> do {
+-           prev_locs.val := List.filter ((!=) myrecord) prev_locs.val;
+-           [: :] } ]
+-     in
+-     let result = go init_loc strm in
+-     do {
+-     prev_locs.val := [myrecord :: prev_locs.val];
+-     myrecord.pl_strm := Obj.repr result;
+-     result } ];
+-
+-value drop_prev_loc strm = stream_map (fun (tok,r) -> (tok,r)) strm;
+-
+-value get_cur_loc strm =
+-  match Stream.peek strm with
+-  [ Some (_,r) -> r.cur_loc
+-  | None -> Loc.ghost ];
+-
+-value get_prev_loc strm =
+-  let c = Stream.count strm in
+-  let rec drop l =
+-    match l with
+-    [ [] -> []
+-    | [(i, _) :: ll] -> if i < c then drop ll else l ]
+-  in
+-  let rec find l =
+-    match l with
+-    [ [] -> None
+-    | [h::t] -> if h.pl_strm == Obj.repr strm then Some h else find t ]
+-  in
+-  match find prev_locs.val with
+-  [ None -> Loc.ghost
+-  | Some r -> do {
+-      r.pl_locs := drop r.pl_locs;
+-      match r.pl_locs with
+-      [ [] -> Loc.ghost
+-      | [(i, loc) :: _] ->
+- if i = c then (Obj.obj loc : Loc.t) else Loc.ghost ] } ];
+-
+-(* ******************************************************************* *)
+-(* END of ugly hack.  This is the previous code.
+-
+   value keep_prev_loc strm =
+     match Stream.peek strm with
+     [ None -> [: :]
+@@ -116,8 +46,6 @@ value get_prev_loc strm =
+     match Stream.peek strm with
+     [ Some (_,r) -> r.prev_loc
+     | None -> Loc.ghost ];
+-*)
+-
+ 
+   value is_level_labelled n lev =
+     match lev.lname with
+diff --git a/camlp4/Camlp4Parsers/Camlp4OCamlParser.ml b/camlp4/Camlp4Parsers/Camlp4OCamlParser.ml
+index c7a510a..1bfdefc 100644
+--- a/camlp4/Camlp4Parsers/Camlp4OCamlParser.ml
++++ b/camlp4/Camlp4Parsers/Camlp4OCamlParser.ml
+@@ -616,11 +616,13 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct
+         | `UIDENT s -> s
+       ] ]
+     ;
++    (* Fix for PR#5090: dummy tokens introduced by the toplevel's lexer
++       to compensate for the lookahead done by the location-handling code *)
+     top_phrase:
+-      [ [ "#"; n = a_LIDENT; dp = opt_expr; ";;" ->
++      [ [ OPT "%%dummy"; "#"; n = a_LIDENT; dp = opt_expr; ";;" ->
+             Some <:str_item< # $n$ $dp$ >>
+-        | l = LIST1 str_item; ";;" -> Some (Ast.stSem_of_list l)
+-        | `EOI -> None
++        | OPT "%%dummy"; l = LIST1 str_item; ";;" -> Some (Ast.stSem_of_list l)
++        | OPT "%%dummy"; `EOI -> None
+       ] ]
+     ;
+   END;
+diff --git a/camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml b/camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml
+index 11fd025..f91e6ab 100644
+--- a/camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml
++++ b/camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml
+@@ -1614,9 +1614,11 @@ Very old (no more supported) syntax:\n\
+         | l = LIST0 [ st = str_item; semi -> st ] -> Ast.stSem_of_list l
+       ] ]
+     ;
++    (* Fix for PR#5090: dummy tokens introduced by the toplevel's lexer
++       to compensate for the lookahead done by the location-handling code *)
+     top_phrase:
+-      [ [ ph = phrase -> Some ph
+-        | `EOI -> None
++      [ [ OPT "%% dummy %%"; ph = phrase -> Some ph
++        | OPT "%% dummy %%"; `EOI -> None
+       ] ]
+     ;
+     use_file:
+diff --git a/camlp4/Camlp4Top/Top.ml b/camlp4/Camlp4Top/Top.ml
+index dcd3aa4..66b3022 100644
+--- a/camlp4/Camlp4Top/Top.ml
++++ b/camlp4/Camlp4Top/Top.ml
+@@ -62,6 +62,15 @@ end;
+ 
+ value lookup x xs = try Some (List.assq x xs) with [ Not_found -> None ];
+ 
++(* Fix for PR#5090: dummy tokens introduced by the toplevel's lexer
++   to compensate for the lookahead done by the location-handling code *)
++value rec add_dummies x =
++  match x with parser
++  [ [: `(KEYWORD x, l); strm :] ->
++       [: `(KEYWORD x, l); `(KEYWORD "%% dummy %%", l); add_dummies strm :]
++  | [: `x; strm :] -> [: `x; add_dummies strm :] ]
++;
++
+ value wrap parse_fun =
+   let token_streams = ref [] in
+   let cleanup lb =
+@@ -101,7 +110,8 @@ value wrap parse_fun =
+         } ];
+ 
+ value toplevel_phrase token_stream =
+-  match Gram.parse_tokens_after_filter Syntax.top_phrase token_stream with
++  match Gram.parse_tokens_after_filter Syntax.top_phrase
++                                       (add_dummies token_stream) with
+     [ Some str_item ->
+         let str_item =
+           AstFilters.fold_topphrase_filters (fun t filter -> filter t) str_item
+-- 
+1.7.4.1
+

0patches/0002-another-fix-for-PR-5090-this-one-seems-to-work-corre.patch

+From 456719ae28d1bcffb2afdde4c1badfb195663485 Mon Sep 17 00:00:00 2001
+From: doligez <doligez@f963ae5c-01c2-4b8c-9fe0-0dff7051ff02>
+Date: Mon, 16 Aug 2010 14:14:10 +0000
+Subject: [PATCH 2/3] another fix for PR#5090; this one seems to work correctly
+
+git-svn-id: http://caml.inria.fr/svn/ocaml/version/3.12@10645 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
+---
+ camlp4/Camlp4/Struct/Grammar/Structure.ml        |    2 +
+ camlp4/Camlp4/Struct/Grammar/Tools.ml            |   34 +++++++++++++++++----
+ camlp4/Camlp4Parsers/Camlp4OCamlParser.ml        |    8 ++---
+ camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml |    6 +--
+ camlp4/Camlp4Top/Top.ml                          |   12 +-------
+ 5 files changed, 35 insertions(+), 27 deletions(-)
+
+diff --git a/camlp4/Camlp4/Struct/Grammar/Structure.ml b/camlp4/Camlp4/Struct/Grammar/Structure.ml
+index c2afdd6..67b99fe 100644
+--- a/camlp4/Camlp4/Struct/Grammar/Structure.ml
++++ b/camlp4/Camlp4/Struct/Grammar/Structure.ml
+@@ -36,6 +36,7 @@ module type S = sig
+ 
+   type token_info = { prev_loc : Loc.t
+                     ; cur_loc : Loc.t
++                    ; prev_loc_only : bool
+                     };
+ 
+   type token_stream = Stream.t (Token.t * token_info);
+@@ -126,6 +127,7 @@ module Make (Lexer  : Sig.Lexer) = struct
+ 
+   type token_info = { prev_loc : Loc.t
+                     ; cur_loc : Loc.t
++                    ; prev_loc_only : bool
+                     };
+ 
+   type token_stream = Stream.t (Token.t * token_info);
+diff --git a/camlp4/Camlp4/Struct/Grammar/Tools.ml b/camlp4/Camlp4/Struct/Grammar/Tools.ml
+index 26489d3..31824eb 100644
+--- a/camlp4/Camlp4/Struct/Grammar/Tools.ml
++++ b/camlp4/Camlp4/Struct/Grammar/Tools.ml
+@@ -16,6 +16,10 @@
+  * - Daniel de Rauglaudre: initial version
+  * - Nicolas Pouillard: refactoring
+  *)
++
++(* PR#5090: don't do lookahead on get_prev_loc. *)
++value get_prev_loc_only = ref False;
++
+ module Make (Structure : Structure.S) = struct
+   open Structure;
+ 
+@@ -29,10 +33,17 @@ module Make (Structure : Structure.S) = struct
+   value keep_prev_loc strm =
+     match Stream.peek strm with
+     [ None -> [: :]
+-    | Some (_,init_loc) ->
+-      let rec go prev_loc = parser
+-        [ [: `(tok,cur_loc); strm :] -> [: `(tok,{prev_loc;cur_loc}); go cur_loc strm :]
+-        | [: :] -> [: :] ]
++    | Some (tok0,init_loc) ->
++      let rec go prev_loc strm1 =
++        if get_prev_loc_only.val then
++          [: `(tok0, {prev_loc; cur_loc = prev_loc; prev_loc_only = True});
++             go prev_loc strm1 :]
++        else
++          match strm1 with parser
++          [ [: `(tok,cur_loc); strm :] ->
++              [: `(tok, {prev_loc; cur_loc; prev_loc_only = False});
++                 go cur_loc strm :]
++          | [: :] -> [: :] ]
+       in go init_loc strm ];
+ 
+   value drop_prev_loc strm = stream_map (fun (tok,r) -> (tok,r.cur_loc)) strm;
+@@ -43,9 +54,18 @@ module Make (Structure : Structure.S) = struct
+     | None -> Loc.ghost ];
+ 
+   value get_prev_loc strm =
+-    match Stream.peek strm with
+-    [ Some (_,r) -> r.prev_loc
+-    | None -> Loc.ghost ];
++    do {
++      get_prev_loc_only.val := True;
++      let result = match Stream.peek strm with
++        [ Some (_, {prev_loc; prev_loc_only = True}) ->
++            do {Stream.junk strm; prev_loc}
++        | Some (_, {prev_loc; prev_loc_only = False}) -> prev_loc
++        | None -> Loc.ghost ]
++      in do {
++        get_prev_loc_only.val := False;
++        result
++      }
++    };
+ 
+   value is_level_labelled n lev =
+     match lev.lname with
+diff --git a/camlp4/Camlp4Parsers/Camlp4OCamlParser.ml b/camlp4/Camlp4Parsers/Camlp4OCamlParser.ml
+index 1bfdefc..c7a510a 100644
+--- a/camlp4/Camlp4Parsers/Camlp4OCamlParser.ml
++++ b/camlp4/Camlp4Parsers/Camlp4OCamlParser.ml
+@@ -616,13 +616,11 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct
+         | `UIDENT s -> s
+       ] ]
+     ;
+-    (* Fix for PR#5090: dummy tokens introduced by the toplevel's lexer
+-       to compensate for the lookahead done by the location-handling code *)
+     top_phrase:
+-      [ [ OPT "%%dummy"; "#"; n = a_LIDENT; dp = opt_expr; ";;" ->
++      [ [ "#"; n = a_LIDENT; dp = opt_expr; ";;" ->
+             Some <:str_item< # $n$ $dp$ >>
+-        | OPT "%%dummy"; l = LIST1 str_item; ";;" -> Some (Ast.stSem_of_list l)
+-        | OPT "%%dummy"; `EOI -> None
++        | l = LIST1 str_item; ";;" -> Some (Ast.stSem_of_list l)
++        | `EOI -> None
+       ] ]
+     ;
+   END;
+diff --git a/camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml b/camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml
+index f91e6ab..11fd025 100644
+--- a/camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml
++++ b/camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml
+@@ -1614,11 +1614,9 @@ Very old (no more supported) syntax:\n\
+         | l = LIST0 [ st = str_item; semi -> st ] -> Ast.stSem_of_list l
+       ] ]
+     ;
+-    (* Fix for PR#5090: dummy tokens introduced by the toplevel's lexer
+-       to compensate for the lookahead done by the location-handling code *)
+     top_phrase:
+-      [ [ OPT "%% dummy %%"; ph = phrase -> Some ph
+-        | OPT "%% dummy %%"; `EOI -> None
++      [ [ ph = phrase -> Some ph
++        | `EOI -> None
+       ] ]
+     ;
+     use_file:
+diff --git a/camlp4/Camlp4Top/Top.ml b/camlp4/Camlp4Top/Top.ml
+index 66b3022..dcd3aa4 100644
+--- a/camlp4/Camlp4Top/Top.ml
++++ b/camlp4/Camlp4Top/Top.ml
+@@ -62,15 +62,6 @@ end;
+ 
+ value lookup x xs = try Some (List.assq x xs) with [ Not_found -> None ];
+ 
+-(* Fix for PR#5090: dummy tokens introduced by the toplevel's lexer
+-   to compensate for the lookahead done by the location-handling code *)
+-value rec add_dummies x =
+-  match x with parser
+-  [ [: `(KEYWORD x, l); strm :] ->
+-       [: `(KEYWORD x, l); `(KEYWORD "%% dummy %%", l); add_dummies strm :]
+-  | [: `x; strm :] -> [: `x; add_dummies strm :] ]
+-;
+-
+ value wrap parse_fun =
+   let token_streams = ref [] in
+   let cleanup lb =
+@@ -110,8 +101,7 @@ value wrap parse_fun =
+         } ];
+ 
+ value toplevel_phrase token_stream =
+-  match Gram.parse_tokens_after_filter Syntax.top_phrase
+-                                       (add_dummies token_stream) with
++  match Gram.parse_tokens_after_filter Syntax.top_phrase token_stream with
+     [ Some str_item ->
+         let str_item =
+           AstFilters.fold_topphrase_filters (fun t filter -> filter t) str_item
+-- 
+1.7.4.1
+

0patches/0003-PR-5090-better-style-of-code.patch

+From bad5f7a74d95b8377aa3f0b730a83a16ed8aa339 Mon Sep 17 00:00:00 2001
+From: doligez <doligez@f963ae5c-01c2-4b8c-9fe0-0dff7051ff02>
+Date: Mon, 16 Aug 2010 14:28:41 +0000
+Subject: [PATCH 3/3] PR#5090: better style of code
+
+git-svn-id: http://caml.inria.fr/svn/ocaml/version/3.12@10646 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
+---
+ camlp4/Camlp4/Struct/Grammar/Tools.ml |   14 ++++++--------
+ 1 files changed, 6 insertions(+), 8 deletions(-)
+
+diff --git a/camlp4/Camlp4/Struct/Grammar/Tools.ml b/camlp4/Camlp4/Struct/Grammar/Tools.ml
+index 31824eb..cb63478 100644
+--- a/camlp4/Camlp4/Struct/Grammar/Tools.ml
++++ b/camlp4/Camlp4/Struct/Grammar/Tools.ml
+@@ -54,18 +54,16 @@ module Make (Structure : Structure.S) = struct
+     | None -> Loc.ghost ];
+ 
+   value get_prev_loc strm =
+-    do {
++    begin
+       get_prev_loc_only.val := True;
+       let result = match Stream.peek strm with
+         [ Some (_, {prev_loc; prev_loc_only = True}) ->
+-            do {Stream.junk strm; prev_loc}
++            begin Stream.junk strm; prev_loc end
+         | Some (_, {prev_loc; prev_loc_only = False}) -> prev_loc
+-        | None -> Loc.ghost ]
+-      in do {
+-        get_prev_loc_only.val := False;
+-        result
+-      }
+-    };
++        | None -> Loc.ghost ];
++      get_prev_loc_only.val := False;
++      result
++    end;
+ 
+   value is_level_labelled n lev =
+     match lev.lname with
+-- 
+1.7.4.1
+

0scripts/0CONF.sh

 BIGVERSION=`echo $VERSION | sed -r -e 's/^([0-9]+\.[0-9]+)\..*$/\1/'`
 
 OCAMLSPOTVERSION=$VERSION-$SPOTVERSION
+
+# HG TAG FOR PURE OCAML
 HG_PURE_OCAML="ocaml-$VERSION-$SVNREV"

0scripts/CHECKCHECK.sh

+#!/bin/sh
+
+set -e
+
+mkdir z
+cp -a ../.hg z/
+(cd z; hg update -C 848)
+mv z/* .
+mv z/.depend .
+
+patch -p1 < compiler_patch.diff
+./configure --prefix $HOME/.share/prefix-test
+make core coreboot
+./build/mixed-boot.sh
+cp boot/myocamlbuild boot/myocamlbuild.boot
+make world opt opt.opt
+echo ===================== testing =======================
+(cd ocamlspot/tests; make; ./auto-test.pl  *.ml *.mli) 
+echo ===================== congrats ======================
+echo Now you can type make intall
+echo Do not forget to install the elisp file, ocamlspot/ocamlspot.el
+echo and configure your .emacs

Binary file modified.

Binary file modified.

Binary file modified.

Binary file modified.

camlp4/Camlp4/Struct/Grammar/Structure.ml

 
   type token_info = { prev_loc : Loc.t
                     ; cur_loc : Loc.t
+                    ; prev_loc_only : bool
                     };
 
   type token_stream = Stream.t (Token.t * token_info);
 
   type token_info = { prev_loc : Loc.t
                     ; cur_loc : Loc.t
+                    ; prev_loc_only : bool
                     };
 
   type token_stream = Stream.t (Token.t * token_info);

camlp4/Camlp4/Struct/Grammar/Tools.ml

  * - Nicolas Pouillard: refactoring
  *)
 
-(* BEGIN ugly hack.  See 15 lines down.  FIXME *)
-
-type prev_locs = {
-  pl_strm : mutable Obj.t;
-  pl_locs : mutable list (int * Obj.t)
-};
-
-value prev_locs = ref ([] : list prev_locs);
-
-(* END ugly hack FIXME *)
+(* PR#5090: don't do lookahead on get_prev_loc. *)
+value get_prev_loc_only = ref False;
 
 module Make (Structure : Structure.S) = struct
   open Structure;
     [ [: ` x; strm :] -> [: ` (f x); stream_map f strm :]
     | [: :] -> [: :] ];
 
-(* ******************************************************************* *)
-(* Ugly hack to prevent PR#5090.  See how to do this properly after
-   the 3.12.0 release.  FIXME.
-*)
-
-value keep_prev_loc strm =
-  match Stream.peek strm with
-  [ None -> [: :]
-  | Some (_, init_loc) ->
-     let myrecord = { pl_strm = Obj.repr [: :];
-                      pl_locs = [(0, Obj.repr init_loc)] }
-     in
-     let rec go prev_loc = parser
-       [ [: `(tok, cur_loc); strm :] -> do {
-           myrecord.pl_locs := myrecord.pl_locs
-                               @ [ (Stream.count strm, Obj.repr cur_loc) ];
-           [: `(tok, {prev_loc; cur_loc}); go cur_loc strm :] }
-       | [: :] -> do {
-           prev_locs.val := List.filter ((!=) myrecord) prev_locs.val;
-           [: :] } ]
-     in
-     let result = go init_loc strm in
-     do {
-     prev_locs.val := [myrecord :: prev_locs.val];
-     myrecord.pl_strm := Obj.repr result;
-     result } ];
-
-value drop_prev_loc strm = stream_map (fun (tok,r) -> (tok,r)) strm;
-
-value get_cur_loc strm =
-  match Stream.peek strm with
-  [ Some (_,r) -> r.cur_loc
-  | None -> Loc.ghost ];
-
-value get_prev_loc strm =
-  let c = Stream.count strm in
-  let rec drop l =
-    match l with
-    [ [] -> []
-    | [(i, _) :: ll] -> if i < c then drop ll else l ]
-  in
-  let rec find l =
-    match l with
-    [ [] -> None
-    | [h::t] -> if h.pl_strm == Obj.repr strm then Some h else find t ]
-  in
-  match find prev_locs.val with
-  [ None -> Loc.ghost
-  | Some r -> do {
-      r.pl_locs := drop r.pl_locs;
-      match r.pl_locs with
-      [ [] -> Loc.ghost
-      | [(i, loc) :: _] ->
- if i = c then (Obj.obj loc : Loc.t) else Loc.ghost ] } ];
-
-(* ******************************************************************* *)
-(* END of ugly hack.  This is the previous code.
-
   value keep_prev_loc strm =
     match Stream.peek strm with
     [ None -> [: :]
-    | Some (_,init_loc) ->
-      let rec go prev_loc = parser
-        [ [: `(tok,cur_loc); strm :] -> [: `(tok,{prev_loc;cur_loc}); go cur_loc strm :]
-        | [: :] -> [: :] ]
+    | Some (tok0,init_loc) ->
+      let rec go prev_loc strm1 =
+        if get_prev_loc_only.val then
+          [: `(tok0, {prev_loc; cur_loc = prev_loc; prev_loc_only = True});
+             go prev_loc strm1 :]
+        else
+          match strm1 with parser
+          [ [: `(tok,cur_loc); strm :] ->
+              [: `(tok, {prev_loc; cur_loc; prev_loc_only = False});
+                 go cur_loc strm :]
+          | [: :] -> [: :] ]
       in go init_loc strm ];
 
   value drop_prev_loc strm = stream_map (fun (tok,r) -> (tok,r.cur_loc)) strm;
     | None -> Loc.ghost ];
 
   value get_prev_loc strm =
-    match Stream.peek strm with
-    [ Some (_,r) -> r.prev_loc
-    | None -> Loc.ghost ];
-*)
-
+    begin
+      get_prev_loc_only.val := True;
+      let result = match Stream.peek strm with
+        [ Some (_, {prev_loc; prev_loc_only = True}) ->
+            begin Stream.junk strm; prev_loc end
+        | Some (_, {prev_loc; prev_loc_only = False}) -> prev_loc
+        | None -> Loc.ghost ];
+      get_prev_loc_only.val := False;
+      result
+    end;
 
   value is_level_labelled n lev =
     match lev.lname with

typing/typecore.ml

 (* Typing of expressions *)
 
 let unify_exp env exp expected_ty =
+  (* Format.eprintf "@[%a@ %a@]@." Printtyp.raw_type_expr exp.exp_type
+    Printtyp.raw_type_expr expected_ty; *)
   try
     unify env exp.exp_type expected_ty
   with
         exp_type = create_package_type loc env (p, l);
         exp_env = env }
   | Pexp_open (lid, e) ->
-      (* workaround to get better loaction *)
+      (* workaround to get better location *)
       let loc = Spot.Location_bound.upperbound loc e.pexp_loc in
       type_exp (!type_open env loc lid) e
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.