aboutsummaryrefslogtreecommitdiff
path: root/kernel/typeops.ml
diff options
context:
space:
mode:
authorVincent Laporte2019-03-13 07:42:00 +0000
committerVincent Laporte2019-03-13 07:42:00 +0000
commite341c36cdc2aa2220152b2a3745bf3255316cdf3 (patch)
tree2d9237639081c31e946c16671d3607cdfce0e760 /kernel/typeops.ml
parentf1d60cad76439d96da36ed7c52ff71b1b9573b80 (diff)
parentab1fd660db052741a3d9aed871251dc3dbee63ca (diff)
Merge PR #9627: Small retroknowledge/primitive cleanup
Ack-by: SkySkimmer Reviewed-by: ppedrot Reviewed-by: vbgl
Diffstat (limited to 'kernel/typeops.ml')
-rw-r--r--kernel/typeops.ml21
1 files changed, 8 insertions, 13 deletions
diff --git a/kernel/typeops.ml b/kernel/typeops.ml
index 7eb8e803b3..227a164549 100644
--- a/kernel/typeops.ml
+++ b/kernel/typeops.ml
@@ -252,6 +252,11 @@ let type_of_prim env t =
in
nary_int63_op (CPrimitives.arity t) return_ty
+let type_of_prim_or_type env = let open CPrimitives in
+ function
+ | OT_type t -> type_of_prim_type env t
+ | OT_op op -> type_of_prim env op
+
let judge_of_int env i =
make_judge (Constr.mkInt i) (type_of_int env)
@@ -664,17 +669,7 @@ let judge_of_case env ci pj cj lfj =
(* Building type of primitive operators and type *)
-open CPrimitives
-
let check_primitive_type env op_t t =
- match op_t with
- | OT_type PT_int63 ->
- (try
- default_conv ~l2r:false CUMUL env mkSet t
- with NotConvertible ->
- CErrors.user_err Pp.(str"Was expecting the sort of this primitive type to be Set"))
- | OT_op p ->
- (try
- default_conv ~l2r:false CUMUL env (type_of_prim env p) t
- with NotConvertible ->
- CErrors.user_err Pp.(str"Not the expected type for this primitive"))
+ let inft = type_of_prim_or_type env op_t in
+ try default_conv ~l2r:false CUMUL env inft t
+ with NotConvertible -> error_incorrect_primitive env (make_judge op_t inft) t