aboutsummaryrefslogtreecommitdiffhomepage
path: root/library/libnames.ml
diff options
context:
space:
mode:
authorGravatar msozeau <msozeau@85f007b7-540e-0410-9357-904b9bb8a0f7>2008-11-05 20:16:13 +0000
committerGravatar msozeau <msozeau@85f007b7-540e-0410-9357-904b9bb8a0f7>2008-11-05 20:16:13 +0000
commit5438bfe94fd1cb0d22de54df53bd0e09328a90a4 (patch)
tree2fa81444edfd27a19c24f177ff8797eaf719de98 /library/libnames.ml
parentc7a38bc3775f6d29af4c2ea31fdec81725ff6ecc (diff)
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
Diffstat (limited to 'library/libnames.ml')
-rw-r--r--library/libnames.ml12
1 files changed, 8 insertions, 4 deletions
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