diff options
| author | Guillaume Melquiond | 2021-03-25 11:27:05 +0100 |
|---|---|---|
| committer | Guillaume Melquiond | 2021-03-26 15:18:28 +0100 |
| commit | 5f6e788e0f404755d6cd1494e18e38758865188f (patch) | |
| tree | 3f1b19ebb52dc24996206e35e3e579d6920c0af1 /kernel/typeops.ml | |
| parent | c2ed2e395f2164ebbc550e70899c49af23e1ad1e (diff) | |
Split the return type away from the signature of primitive operations.
This avoids having to drop the last element of the signature in the
common case.
Diffstat (limited to 'kernel/typeops.ml')
| -rw-r--r-- | kernel/typeops.ml | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/kernel/typeops.ml b/kernel/typeops.ml index 741491c917..1b1aa84e6b 100644 --- a/kernel/typeops.ml +++ b/kernel/typeops.ml @@ -785,15 +785,16 @@ let type_of_prim env u t = | PITT_type (ty,t) -> tr_prim_type (tr_type n) ty t | PITT_param i -> Constr.mkRel (n+i) in - let rec nary_op n = function - | [] -> assert false - | [ret_ty] -> tr_type n ret_ty + let rec nary_op n ret_ty = function + | [] -> tr_type n ret_ty | arg_ty :: r -> - Constr.mkProd(Context.nameR (Id.of_string "x"), tr_type n arg_ty, nary_op (n+1) r) + Constr.mkProd (Context.nameR (Id.of_string "x"), + tr_type n arg_ty, nary_op (n + 1) ret_ty r) in - let params, sign = types t in + let params, args_ty, ret_ty = types t in assert (AUContext.size (univs t) = Instance.length u); - Vars.subst_instance_constr u (Term.it_mkProd_or_LetIn (nary_op 0 sign) params) + Vars.subst_instance_constr u + (Term.it_mkProd_or_LetIn (nary_op 0 ret_ty args_ty) params) let type_of_prim_or_type env u = let open CPrimitives in function |
