aboutsummaryrefslogtreecommitdiff
path: root/checker/mod_checking.ml
diff options
context:
space:
mode:
authorPierre Roux2020-04-15 12:40:21 +0200
committerPierre Roux2020-05-22 12:15:22 +0200
commit5b2e6c3567329ebe8d9a680ef914a84aeae312a1 (patch)
treeba452f13d8b0498c1f75a8681aaedb1080ec0d23 /checker/mod_checking.ml
parent4bab69688d91648ec1725f6294b7430622e6accf (diff)
[coqchk] Improve previous heuristic.
Instead of considering all constants without body in the environment, consider only the ones appearing in the body of the opacified constant.
Diffstat (limited to 'checker/mod_checking.ml')
-rw-r--r--checker/mod_checking.ml17
1 files changed, 11 insertions, 6 deletions
diff --git a/checker/mod_checking.ml b/checker/mod_checking.ml
index c2b486c371..999f44bf1d 100644
--- a/checker/mod_checking.ml
+++ b/checker/mod_checking.ml
@@ -15,15 +15,20 @@ let indirect_accessor = ref {
let set_indirect_accessor f = indirect_accessor := f
-let register_opacified_constant env opac kn =
+let register_opacified_constant env opac kn cb =
+ let rec gather_consts s c =
+ match Constr.kind c with
+ | Constr.Const (c, _) -> Cset.add c s
+ | _ -> Constr.fold gather_consts s c
+ in
let wo_body =
- fold_constants
- (fun kn cb s ->
- if Declareops.constant_has_body cb then s else
+ Cset.fold
+ (fun kn s ->
+ if Declareops.constant_has_body (lookup_constant kn env) then s else
match Cmap.find_opt kn opac with
| None -> Cset.add kn s
| Some s' -> Cset.union s' s)
- env
+ (gather_consts Cset.empty cb)
Cset.empty
in
Cmap.add kn wo_body opac
@@ -68,7 +73,7 @@ let check_constant_declaration env opac kn cb opacify =
| None -> ()
in
match body with
- | Some _ when opacify -> register_opacified_constant env opac kn
+ | Some body when opacify -> register_opacified_constant env opac kn body
| Some _ | None -> opac
let check_constant_declaration env opac kn cb opacify =