Skip to content

Commit

Permalink
Flow: Print tvar ids in comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
pvolok committed Oct 8, 2016
1 parent 85f4cd1 commit 44e0553
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
7 changes: 2 additions & 5 deletions jscomp/flow.ml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ and p_type_decl s type_decl =
and p_type_expr s type_expr =
match type_expr.desc with
| Tvar str ->
let str = match str with
| Some x -> x
| None -> "-" in
p_any ("Tvar " ^ str)
p_any ("Tvar " ^ (string_of_int type_expr.id))
| Tarrow (label, left, right, c) -> p_arrow s (label, left, right, c)
| Ttuple tl -> T_tuple (List.map (p_type_expr s) tl)
| Tconstr (path, tl, _) ->
Expand All @@ -71,7 +68,7 @@ and p_type_expr s type_expr =
let decl = {decl_name; decl_type} in
s.types <- decl :: s.types
end;
p_named decl_name
p_named ~tl:(List.map (p_type_expr s) tl) decl_name
end
| Tobject _ -> p_any "Tobject"
| Tfield _ -> p_any "Tfield" (* Shouldn't ever happen? *)
Expand Down
9 changes: 8 additions & 1 deletion jscomp/test_flow/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion jscomp/test_flow/main.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ declare export var mk_tuple: (p0: M__t, p1: number, p2: void) => [number, number

declare export var mk_rec: (p0: obj_t) => rec_t;

declare export var mk_obj: (p0: /* Tvar - */any) => {id: number, name: string};
declare export var mk_obj: (p0: /* Tvar 1912 */any) => {id: number, name: string};

declare export var mk_arr: (p0: void) => Array<number>;

Expand All @@ -27,3 +27,5 @@ declare export var from_util: (p0: Util__t) => void;
declare export var float_: number;

declare export var tt: tt$0;

declare export var iter: (p0: Array</* Tvar 2242 */any>, p1: Array</* Tvar 2255 */any>, p2: (p0: /* Tvar 2242 */any) => void, p3: (p0: /* Tvar 2255 */any) => void) => void;
2 changes: 2 additions & 0 deletions jscomp/test_flow/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ let float_ = 1.0

type tt = int
let tt: tt = 0

let iter items1 items2 fn1 fn2 = Array.iter fn1 items1; Array.iter fn2 items2

0 comments on commit 44e0553

Please sign in to comment.