diff options
| author | Enrico Tassi | 2019-02-22 14:10:06 +0100 |
|---|---|---|
| committer | Enrico Tassi | 2019-02-25 11:33:18 +0100 |
| commit | 8cad12e0e48eae83773667c2fab7d2570ed43ed2 (patch) | |
| tree | 981ebac6ce36a36fe6ae0fb89543b0b1ab46db12 /kernel/inductive.ml | |
| parent | 5ee6581330ac77596d31dddc1bf4fc09e585b1f6 (diff) | |
[kernel] termination checking backtracks on stuck primitive projection
Diffstat (limited to 'kernel/inductive.ml')
| -rw-r--r-- | kernel/inductive.ml | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/kernel/inductive.ml b/kernel/inductive.ml index c0f41d2bc9..48856c5c0d 100644 --- a/kernel/inductive.ml +++ b/kernel/inductive.ml @@ -1015,9 +1015,22 @@ let check_one_fix renv recpos trees def = | (Ind _ | Construct _) -> List.iter (check_rec_call renv []) l - | Proj (_p, c) -> - List.iter (check_rec_call renv []) l; - check_rec_call renv [] c + | Proj (p, c) -> + begin try + List.iter (check_rec_call renv []) l; + check_rec_call renv [] c + with (FixGuardError _ as exn) -> + let exn = CErrors.push exn in + (* we try hard to reduce the proj away by looking for a + constructor in c (we unfold definitions too) *) + let c = whd_all renv.env c in + let hd, _ = decompose_app c in + match kind hd with + | Construct _ -> + check_rec_call renv [] + (Term.applist (mkProj(Projection.unfold p,c), l)) + | _ -> Exninfo.iraise exn + end | Var id -> begin |
