aboutsummaryrefslogtreecommitdiffhomepage
path: root/pretyping/pattern.ml
diff options
context:
space:
mode:
authorGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2001-02-07 10:02:40 +0000
committerGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2001-02-07 10:02:40 +0000
commit78384438637eb9ce2f11f61bafc59f17c5f933da (patch)
treef1968f737066e0e736f01b5fd4c8c9c5bccacdfc /pretyping/pattern.ml
parent9c662cf9e8f4065ab354dc9c55c3e819f0db1fbe (diff)
Retrait de EvarRef de global_reference; nettoyage autour de ast_of_ref
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@1340 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'pretyping/pattern.ml')
-rw-r--r--pretyping/pattern.ml10
1 files changed, 6 insertions, 4 deletions
diff --git a/pretyping/pattern.ml b/pretyping/pattern.ml
index d1566419c..513e47ea0 100644
--- a/pretyping/pattern.ml
+++ b/pretyping/pattern.ml
@@ -11,6 +11,7 @@ open Environ
type constr_pattern =
| PRef of global_reference
| PVar of identifier
+ | PEvar of existential_key
| PRel of int
| PApp of constr_pattern * constr_pattern array
| PSoApp of int * constr_pattern list
@@ -31,7 +32,7 @@ let rec occur_meta_pattern = function
(occur_meta_pattern p) or
(occur_meta_pattern c) or (array_exists occur_meta_pattern br)
| PMeta _ | PSoApp _ -> true
- | PVar _ | PRef _ | PRel _ | PSort _ | PFix _ | PCoFix _ -> false
+ | PEvar _ | PVar _ | PRef _ | PRel _ | PSort _ | PFix _ | PCoFix _ -> false
type constr_label =
| ConstNode of section_path
@@ -50,7 +51,6 @@ let label_of_ref = function
| IndRef sp -> IndNode sp
| ConstructRef sp -> CstrNode sp
| VarRef sp -> SectionVarNode sp
- | EvarRef n -> raise BoundPattern
let rec head_pattern_bound t =
match t with
@@ -59,7 +59,8 @@ let rec head_pattern_bound t =
| PCase (p,c,br) -> head_pattern_bound c
| PRef r -> label_of_ref r
| PVar id -> VarNode id
- | PRel _ | PMeta _ | PSoApp _ | PSort _ | PFix _ -> raise BoundPattern
+ | PEvar _ | PRel _ | PMeta _ | PSoApp _ | PSort _ | PFix _
+ -> raise BoundPattern
(* Perhaps they were arguments, but we don't beta-reduce *)
| PBinder(BLambda,_,_,_) -> raise BoundPattern
| PCoFix _ -> anomaly "head_pattern_bound: not a type"
@@ -313,7 +314,8 @@ let rec pattern_of_constr t =
| IsMutConstruct (sp,ctxt) ->
pattern_of_ref (ConstructRef sp) ctxt
| IsEvar (n,ctxt) ->
- pattern_of_ref (EvarRef n) ctxt
+ if ctxt = [||] then PEvar n
+ else PApp (PEvar n, Array.map pattern_of_constr ctxt)
| IsMutCase (ci,p,a,br) ->
PCase (Some (pattern_of_constr p),pattern_of_constr a,
Array.map pattern_of_constr br)