diff options
| -rw-r--r-- | pretyping/matching.ml | 4 | ||||
| -rw-r--r-- | pretyping/matching.mli | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/pretyping/matching.ml b/pretyping/matching.ml index b42365679b..06fdc778ee 100644 --- a/pretyping/matching.ml +++ b/pretyping/matching.ml @@ -164,8 +164,10 @@ let pmatches = matches_core None true (* To skip to the next occurrence *) exception NextOccurrence of int -(* Tells if it is an authorized occurrence *) +(* Tells if it is an authorized occurrence and if the instance is closed *) let authorized_occ nocc mres = + if not (List.for_all (fun (_,c) -> closed0 c) (fst mres)) then + raise PatternMatchingFailure; if nocc = 0 then mres else raise (NextOccurrence nocc) diff --git a/pretyping/matching.mli b/pretyping/matching.mli index 32c2906b64..c7c9905ee7 100644 --- a/pretyping/matching.mli +++ b/pretyping/matching.mli @@ -42,7 +42,7 @@ val matches_conv :env -> Evd.evar_map -> constr_pattern -> constr -> patvar_map (* To skip to the next occurrence *) exception NextOccurrence of int -(* Tries to match a subterm of [c] with [pat] *) +(* Tries to match a _closed_ subterm of [c] with [pat] *) val sub_match : int -> constr_pattern -> constr -> patvar_map * constr (* [is_matching_conv env sigma pat c] tells if [c] matches against [pat] |
