From 5316d205993bb3fe3f69e8984fe53d4d50aa8d2a Mon Sep 17 00:00:00 2001 From: Pierre-Marie Pédrot Date: Tue, 4 Jun 2019 13:44:05 +0200 Subject: Allow to delay polymorphic opaque constants. We had to move the private opaque constraints out of the constant declaration into the opaque table. The API is not very pretty yet due to a pervasive confusion between monomorphic global constraints and polymorphic local ones, but once we get rid of futures in the kernel this should be magically solved. --- checker/mod_checking.ml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'checker/mod_checking.ml') diff --git a/checker/mod_checking.ml b/checker/mod_checking.ml index 0684623a81..7e49e741ad 100644 --- a/checker/mod_checking.ml +++ b/checker/mod_checking.ml @@ -31,16 +31,19 @@ let check_constant_declaration env kn cb = in let ty = cb.const_type in let _ = infer_type env' ty in - let env' = match cb.const_private_poly_univs, (cb.const_body, poly) with - | None, _ -> env' - | Some local, (OpaqueDef _, true) -> push_subgraph local env' - | Some _, _ -> assert false - in - let otab = Environ.opaque_tables env in - let body = match cb.const_body with - | Undef _ | Primitive _ -> None - | Def c -> Some (Mod_subst.force_constr c) - | OpaqueDef o -> Some (Opaqueproof.force_proof !indirect_accessor otab o) + let otab = Environ.opaque_tables env' in + let body, env' = match cb.const_body with + | Undef _ | Primitive _ -> None, env' + | Def c -> Some (Mod_subst.force_constr c), env' + | OpaqueDef o -> + let c, u = Opaqueproof.force_proof !indirect_accessor otab o in + let env' = match u, cb.const_universes with + | Opaqueproof.PrivateMonomorphic (), Monomorphic _ -> env' + | Opaqueproof.PrivatePolymorphic local, Polymorphic _ -> + push_subgraph local env' + | _ -> assert false + in + Some c, env' in let () = match body with -- cgit v1.2.3