Permalink
Browse files

Generate simpler top-level value bindings for p4_value.

Previously, a `type t = int` would generate:
```
let (value_of_t : ?id_seed: (Int64.t ref) -> t -> Dyntype.Value.t) =
```

Now, we generate the simpler:
```
let value_of_t = <...>
```

This is because type_conv-108.07.00 attempts to parse the toplevel
bindings and generate dummy references to suppress the OCaml4
'unused variable' warning.  This generation is buggy, and does not
differentiate between value bindings and the type hints.
  • Loading branch information...
avsm committed Oct 1, 2012
1 parent 1b6ab38 commit 3569269c8cad3f013151fb1b5d89cf76981f1df1
Showing with 2 additions and 6 deletions.
  1. +2 −6 pa_lib/p4_value.ml
View
@@ -204,11 +204,7 @@ module Value_of = struct
biAnd_of_list bindings
let inputs _loc ~id_seed_t ~opt ids =
- let value_of_fn x =
- if opt then
- <:patt< ($lid:value_of x$ : ?id_seed:$id_seed_t$ -> $lid:x$ -> Dyntype.Value.t) >>
- else
- <:patt< ($lid:value_of x$ : ~id_seed:$id_seed_t$ -> $lid:x$ -> Dyntype.Value.t) >> in
+ let value_of_fn x = <:patt< $lid:value_of x$ >> in
let value_of_fns = List.map value_of_fn ids in
patt_tuple_of_list _loc value_of_fns
@@ -408,7 +404,7 @@ module Of_value = struct
biAnd_of_list bindings
let inputs _loc ids =
- let of_value_fns = List.map (fun x -> <:patt< ($lid:of_value x$ : Dyntype.Value.t -> $lid:x$) >>) ids in
+ let of_value_fns = List.map (fun x -> <:patt< $lid:of_value x$ >>) ids in
patt_tuple_of_list _loc of_value_fns
let outputs _loc ids =

0 comments on commit 3569269

Please sign in to comment.