aboutsummaryrefslogtreecommitdiffhomepage
path: root/kernel/term_typing.ml
diff options
context:
space:
mode:
authorGravatar Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr>2017-03-27 00:22:51 +0200
committerGravatar Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr>2017-03-27 11:32:16 +0200
commitff996b19faeff112a156f5db6c9ab9f26e855145 (patch)
treed5921b7ff9df606a0ff3fcb3830ab12af307eb91 /kernel/term_typing.ml
parent7535e268f7706d1dee263fdbafadf920349103db (diff)
Fix hashconsing of terms in the kernel.
In one case, the hashconsed type of a judgement was not used anywhere else. In another case, the Opaqueproof module was rehashconsing terms that had already gone through a hashconsing phase. Indeed, most OpaqueDef constructor applications actually called it beforehand, so that the one performed in Opaqueproof was most often useless. The only case where this was not true was at section closing time, so that we tweak the Cooking.cook_constant to perform hashconsing for us.
Diffstat (limited to 'kernel/term_typing.ml')
-rw-r--r--kernel/term_typing.ml7
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/term_typing.ml b/kernel/term_typing.ml
index 2eb2c040e..2eba1eb2a 100644
--- a/kernel/term_typing.ml
+++ b/kernel/term_typing.ml
@@ -186,7 +186,8 @@ let rec unzip ctx j =
unzip ctx { j with uj_val = mkApp (mkLambda (n,ty,j.uj_val),arg) }
let hcons_j j =
- { uj_val = hcons_constr j.uj_val; uj_type = hcons_constr j.uj_type}
+ (** Do not hashcons type: it is not used by the callers of this function. *)
+ { uj_val = hcons_constr j.uj_val; uj_type = j.uj_type}
let feedback_completion_typecheck =
let open Feedback in
@@ -507,7 +508,9 @@ let translate_local_assum env t =
t
let translate_recipe env kn r =
- build_constant_declaration kn env (Cooking.cook_constant env r)
+ let (_, dir, _) = Constant.repr3 kn in
+ let hcons = DirPath.is_empty dir in
+ build_constant_declaration kn env (Cooking.cook_constant ~hcons env r)
let translate_local_def mb env id centry =
let def,typ,proj,poly,univs,inline_code,ctx =