From 5438bfe94fd1cb0d22de54df53bd0e09328a90a4 Mon Sep 17 00:00:00 2001 From: msozeau Date: Wed, 5 Nov 2008 20:16:13 +0000 Subject: Move Record desugaring to constrintern and add ability to use notations for record fields (using "someproj : sometype where not := constr" syntax). Only one notation allowed currently and no redeclaration after the record declaration either (will be done for typeclasses). git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@11542 85f007b7-540e-0410-9357-904b9bb8a0f7 --- library/libnames.ml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'library/libnames.ml') diff --git a/library/libnames.ml b/library/libnames.ml index 04ab34baa..bf02efb03 100644 --- a/library/libnames.ml +++ b/library/libnames.ml @@ -24,6 +24,11 @@ type global_reference = let isVarRef = function VarRef _ -> true | _ -> false +let subst_constructor subst ((kn,i),j as ref) = + let kn' = subst_kn subst kn in + if kn==kn' then ref, mkConstruct ref + else ((kn',i),j), mkConstruct ((kn',i),j) + let subst_global subst ref = match ref with | VarRef var -> ref, mkVar var | ConstRef kn -> @@ -32,10 +37,9 @@ let subst_global subst ref = match ref with | IndRef (kn,i) -> let kn' = subst_kn subst kn in if kn==kn' then ref, mkInd (kn,i) else IndRef(kn',i), mkInd (kn',i) - | ConstructRef ((kn,i),j) -> - let kn' = subst_kn subst kn in - if kn==kn' then ref, mkConstruct ((kn,i),j) - else ConstructRef ((kn',i),j), mkConstruct ((kn',i),j) + | ConstructRef ((kn,i),j as c) -> + let c',t = subst_constructor subst c in + if c'==c then ref,t else ConstructRef c', t let global_of_constr c = match kind_of_term c with | Const sp -> ConstRef sp -- cgit v1.2.3