Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused field, triggering a compiler warning #300

Merged
merged 2 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## NEXT RELEASE

- ...
- Remove unread `fun_gen` field from `QCheck2`'s `fun_repr_tbl` type
thereby silencing a compiler warning

## 0.22

Expand Down
7 changes: 3 additions & 4 deletions src/core/QCheck2.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,6 @@ end
(** Internal representation of functions, used for shrinking and printing (in case of error). *)
type ('a, 'b) fun_repr_tbl = {
fun_tbl: ('a, 'b) Poly_tbl.t; (** Input-output bindings *)
fun_gen: 'b Gen.t; (** How to generate output values *)
fun_print: 'b Print.t option; (** How to print output values *)
fun_default: 'b; (** Default value for all inputs not explicitly mapped in {!fun_tbl} *)
}
Expand Down Expand Up @@ -1203,8 +1202,8 @@ module Fn = struct

let make_ (r : 'a fun_repr) : 'a fun_ = Fun (r, function_of_repr r)

let mk_repr tbl gen ?print def =
Fun_tbl { fun_tbl=tbl; fun_gen=gen; fun_print=print; fun_default=def; }
let mk_repr tbl ?print def =
Fun_tbl { fun_tbl=tbl; fun_print=print; fun_default=def; }

let map_repr f repr = Fun_map (f, repr)

Expand Down Expand Up @@ -1233,7 +1232,7 @@ module Fn = struct
(** [gen_rep obs gen] creates a function generator. Input values are observed with [obs] and
output values are generated with [gen]. *)
let gen_rep (obs : 'a Observable.t) ?(print : 'b Print.t option) (gen : 'b Gen.t) : ('a -> 'b) fun_repr Gen.t =
Gen.liftA2 (fun default_value poly_tbl -> mk_repr poly_tbl gen ?print default_value) gen (Poly_tbl.create ?v_print:print obs gen 8)
Gen.liftA2 (fun default_value poly_tbl -> mk_repr poly_tbl ?print default_value) gen (Poly_tbl.create ?v_print:print obs gen 8)

let gen (obs : 'a Observable.t) ?(print : 'b Print.t option) (gen : 'b Gen.t) : ('a -> 'b) fun_ Gen.t =
Gen.map make_ (gen_rep obs gen ?print)
Expand Down
Loading