From b1cb26eed7bdde340aeacf23e1bc461eb06c4ddd Mon Sep 17 00:00:00 2001 From: Emilio Jesus Gallego Arias Date: Sat, 7 Nov 2020 23:14:53 +0100 Subject: [obligation] Proper handle no obligations on `Next Obligation` Fixes #13320 . Trivial programming error, actually this is handled better in a further refactoring branch not submitted due to the long time the whole rework took. --- test-suite/output/bug_13320.out | 2 ++ test-suite/output/bug_13320.v | 2 ++ vernac/declare.ml | 7 ++++++- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 test-suite/output/bug_13320.out create mode 100644 test-suite/output/bug_13320.v diff --git a/test-suite/output/bug_13320.out b/test-suite/output/bug_13320.out new file mode 100644 index 0000000000..97efe1da87 --- /dev/null +++ b/test-suite/output/bug_13320.out @@ -0,0 +1,2 @@ +The command has indeed failed with message: +No obligations remaining diff --git a/test-suite/output/bug_13320.v b/test-suite/output/bug_13320.v new file mode 100644 index 0000000000..6f3c51bbe7 --- /dev/null +++ b/test-suite/output/bug_13320.v @@ -0,0 +1,2 @@ +(* Next Obligation should fail normally, not with an anomaly. *) +Fail Next Obligation. diff --git a/vernac/declare.ml b/vernac/declare.ml index 0baae6eca5..367d0bf944 100644 --- a/vernac/declare.ml +++ b/vernac/declare.ml @@ -2499,7 +2499,12 @@ let admit_obligations ~pm n = let next_obligation ~pm n tac = let prg = match n with - | None -> State.first_pending pm |> Option.get + | None -> + begin match State.first_pending pm with + | Some prg -> prg + | None -> + Error.no_obligations None + end | Some _ -> get_unique_prog ~pm n in let {obls; remaining} = Internal.get_obligations prg in -- cgit v1.2.3