diff options
| author | Pierre-Marie Pédrot | 2018-10-04 11:10:50 +0200 |
|---|---|---|
| committer | Pierre-Marie Pédrot | 2018-10-04 11:10:50 +0200 |
| commit | 79da82da057224eec8abaf96c20b0725f18b2945 (patch) | |
| tree | 2a64cf563eb5f8d39e3fdfb4aa10053dd2e4f6ae | |
| parent | 07ae306b9601653a6edbdefd1b3b5275439611bf (diff) | |
| parent | 8ef1be1aead0dbcc2d3cc46a7e5eaa02f9ad6069 (diff) | |
Merge PR #7361: Towards selecting "best" unification failure among several
| -rw-r--r-- | pretyping/evarconv.ml | 12 | ||||
| -rw-r--r-- | test-suite/output/unifconstraints.out | 8 | ||||
| -rw-r--r-- | test-suite/output/unifconstraints.v | 6 |
3 files changed, 25 insertions, 1 deletions
diff --git a/pretyping/evarconv.ml b/pretyping/evarconv.ml index 7d480b8d48..e978adf761 100644 --- a/pretyping/evarconv.ml +++ b/pretyping/evarconv.ml @@ -227,13 +227,23 @@ let check_conv_record env sigma (t1,sk1) (t2,sk2) = (* Precondition: one of the terms of the pb is an uninstantiated evar, * possibly applied to arguments. *) +let join_failures evd1 evd2 e1 e2 = + match e1, e2 with + | _, CannotSolveConstraint (_,ProblemBeyondCapabilities) -> (evd1,e1) + | _ -> (evd2,e2) + let rec ise_try evd = function [] -> assert false | [f] -> f evd | f1::l -> match f1 evd with | Success _ as x -> x - | UnifFailure _ -> ise_try evd l + | UnifFailure (evd1,e1) -> + match ise_try evd l with + | Success _ as x -> x + | UnifFailure (evd2,e2) -> + let evd,e = join_failures evd1 evd2 e1 e2 in + UnifFailure (evd,e) let ise_and evd l = let rec ise_and i = function diff --git a/test-suite/output/unifconstraints.out b/test-suite/output/unifconstraints.out index ae84603622..2fadd747b7 100644 --- a/test-suite/output/unifconstraints.out +++ b/test-suite/output/unifconstraints.out @@ -63,3 +63,11 @@ unification constraint: True /\ True /\ True \/ veeryyyyyyyyyyyyloooooooooooooonggidentifier = veeryyyyyyyyyyyyloooooooooooooonggidentifier +The command has indeed failed with message: +In environment +P : nat -> Type +x : nat +h : P x +Unable to unify "P x" with "?P x" +(unable to find a well-typed instantiation for "?P": cannot ensure that +"nat -> Type" is a subtype of "nat -> Prop"). diff --git a/test-suite/output/unifconstraints.v b/test-suite/output/unifconstraints.v index b9413a4ac2..179dec3fb0 100644 --- a/test-suite/output/unifconstraints.v +++ b/test-suite/output/unifconstraints.v @@ -20,3 +20,9 @@ Goal forall n m : nat, True /\ True /\ True \/ 3:clear m. Show. Admitted. +Unset Printing Existential Instances. + +(* Check non regression of error message (the example can eventually + improve though and succeed) *) + +Fail Check fun P (x:nat) (h:P x) => exist _ x (h : P x). |
