aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2015-02-11 17:55:50 +0100
committerPierre-Marie Pédrot2015-02-11 17:55:50 +0100
commit37076a63ebd1491f26a6c5a3d67e054c106589b3 (patch)
tree702d4be5c21408ce819b1265ac7cd4d5d2c2866d /kernel
parent956b7c4304582b1e9e3ca0bb34944bcbac18c0cc (diff)
parentac65eef8bbc2e405f1964f35c6a129dfa1755888 (diff)
Merge branch 'v8.5'
Diffstat (limited to 'kernel')
-rw-r--r--kernel/typeops.ml10
-rw-r--r--kernel/univ.ml45
2 files changed, 32 insertions, 23 deletions
diff --git a/kernel/typeops.ml b/kernel/typeops.ml
index 2642b1867d..48dbacf1a4 100644
--- a/kernel/typeops.ml
+++ b/kernel/typeops.ml
@@ -153,13 +153,13 @@ let type_of_constant_type_knowing_parameters env t paramtyps =
let type_of_constant_knowing_parameters env cst paramtyps =
let cb = lookup_constant (fst cst) env in
- let _ = check_hyps_inclusion env (mkConstU cst) cb.const_hyps in
+ let () = check_hyps_inclusion env (mkConstU cst) cb.const_hyps in
let ty, cu = constant_type env cst in
type_of_constant_type_knowing_parameters env ty paramtyps, cu
let type_of_constant_knowing_parameters_in env cst paramtyps =
let cb = lookup_constant (fst cst) env in
- let _ = check_hyps_inclusion env (mkConstU cst) cb.const_hyps in
+ let () = check_hyps_inclusion env (mkConstU cst) cb.const_hyps in
let ty = constant_type_in env cst in
type_of_constant_type_knowing_parameters env ty paramtyps
@@ -171,14 +171,14 @@ let type_of_constant env cst =
let type_of_constant_in env cst =
let cb = lookup_constant (fst cst) env in
- let _ = check_hyps_inclusion env (mkConstU cst) cb.const_hyps in
+ let () = check_hyps_inclusion env (mkConstU cst) cb.const_hyps in
let ar = constant_type_in env cst in
type_of_constant_type_knowing_parameters env ar [||]
let judge_of_constant_knowing_parameters env (kn,u as cst) args =
let c = mkConstU cst in
let ty, cu = type_of_constant_knowing_parameters env cst args in
- let _ = Environ.check_constraints cu env in
+ let () = check_constraints cu env in
make_judge c ty
let judge_of_constant env cst =
@@ -372,7 +372,7 @@ let judge_of_case env ci pj cj lfj =
let (pind, _ as indspec) =
try find_rectype env cj.uj_type
with Not_found -> error_case_not_inductive env cj in
- let _ = check_case_info env pind ci in
+ let () = check_case_info env pind ci in
let (bty,rslty) =
type_case_branches env indspec pj cj.uj_val in
let () = check_branch_types env pind cj (lfj,bty) in
diff --git a/kernel/univ.ml b/kernel/univ.ml
index 492762df39..763c0822f2 100644
--- a/kernel/univ.ml
+++ b/kernel/univ.ml
@@ -194,7 +194,17 @@ struct
| Level _, _ -> -1
| _, Level _ -> 1
| Var n, Var m -> Int.compare n m
-
+
+ let hequal x y =
+ x == y ||
+ match x, y with
+ | Prop, Prop -> true
+ | Set, Set -> true
+ | Level (n,d), Level (n',d') ->
+ n == n' && d == d'
+ | Var n, Var n' -> n == n'
+ | _ -> false
+
let hcons = function
| Prop as x -> x
| Set as x -> x
@@ -233,27 +243,26 @@ module Level = struct
let hash x = x.hash
- let hcons x =
- let data' = RawLevel.hcons x.data in
- if data' == x.data then x
- else { x with data = data' }
-
let data x = x.data
(** Hashcons on levels + their hash *)
- let make =
- let module Self = struct
- type _t = t
- type t = _t
- let equal = equal
- let hash = hash
- end in
- let module WH = Weak.Make(Self) in
- let pool = WH.create 4910 in fun x ->
- let x = { hash = RawLevel.hash x; data = x } in
- try WH.find pool x
- with Not_found -> WH.add pool x; x
+ module Self = struct
+ type _t = t
+ type t = _t
+ type u = unit
+ let equal x y = x.hash == y.hash && RawLevel.hequal x.data y.data
+ let hash x = x.hash
+ let hashcons () x =
+ let data' = RawLevel.hcons x.data in
+ if x.data == data' then x else { x with data = data' }
+ end
+
+ let hcons =
+ let module H = Hashcons.Make(Self) in
+ Hashcons.simple_hcons H.generate H.hcons ()
+
+ let make l = hcons { hash = RawLevel.hash l; data = l }
let set = make Set
let prop = make Prop