diff options
author | Siddharth Bhat <siddu.druid@gmail.com> | 2018-06-27 22:03:25 +0200 |
---|---|---|
committer | Siddharth Bhat <siddu.druid@gmail.com> | 2018-07-17 13:14:44 +0200 |
commit | 1300da19d13f7e46cf3a4b0b3396604ffc44a6d5 (patch) | |
tree | 577f1c1b6dbc64382a7623d77bc6e6756ed45a96 /vernac | |
parent | b799252775563b4f46f5ea39cbfc469759e7a296 (diff) |
Change QuestionMark for better record field missing error message.
While we were adding a new field into `QuestionMark`, we
decided to go ahead and refactor the constructor to hold
an actual record. This record now holds the name, obligations, and
whether the evar represents a missing record field.
This is used to provide better error messages on missing record
fields.
Diffstat (limited to 'vernac')
-rw-r--r-- | vernac/comProgramFixpoint.ml | 6 | ||||
-rw-r--r-- | vernac/himsg.ml | 8 | ||||
-rw-r--r-- | vernac/obligations.ml | 2 |
3 files changed, 12 insertions, 4 deletions
diff --git a/vernac/comProgramFixpoint.ml b/vernac/comProgramFixpoint.ml index eef7afbfb..00d14f5b0 100644 --- a/vernac/comProgramFixpoint.ml +++ b/vernac/comProgramFixpoint.ml @@ -187,7 +187,11 @@ let build_wellfounded (recname,pl,n,bl,arityc,body) poly r measure notation = let sigma, def = let sigma, h_a_term = Evarutil.new_global sigma (delayed_force fix_sub_ref) in let sigma, h_e_term = Evarutil.new_evar env sigma - ~src:(Loc.tag @@ Evar_kinds.QuestionMark (Evar_kinds.Define false,Anonymous)) wf_proof in + ~src:(Loc.tag @@ Evar_kinds.QuestionMark { + Evar_kinds.qm_obligation=Evar_kinds.Define false; + Evar_kinds.qm_name=Anonymous; + Evar_kinds.qm_record_field=None; + }) wf_proof in sigma, mkApp (h_a_term, [| argtyp ; wf_rel ; h_e_term; prop |]) in let sigma, def = Typing.solve_evars env sigma def in diff --git a/vernac/himsg.ml b/vernac/himsg.ml index 534e58f9c..c49ffe267 100644 --- a/vernac/himsg.ml +++ b/vernac/himsg.ml @@ -520,11 +520,15 @@ let pr_trailing_ne_context_of env sigma = then str "." else (str " in environment:"++ pr_context_unlimited env sigma) -let rec explain_evar_kind env sigma evk ty = function +let rec explain_evar_kind env sigma evk ty = + let open Evar_kinds in + function | Evar_kinds.NamedHole id -> strbrk "the existential variable named " ++ Id.print id - | Evar_kinds.QuestionMark _ -> + | Evar_kinds.QuestionMark {qm_record_field=None} -> strbrk "this placeholder of type " ++ ty + | Evar_kinds.QuestionMark {qm_record_field=Some {fieldname; recordname}} -> + str "field " ++ (Printer.pr_constant env fieldname) ++ str " of record " ++ (Printer.pr_inductive env recordname) | Evar_kinds.CasesType false -> strbrk "the type of this pattern-matching problem" | Evar_kinds.CasesType true -> diff --git a/vernac/obligations.ml b/vernac/obligations.ml index 1f401b4e1..14d764232 100644 --- a/vernac/obligations.ml +++ b/vernac/obligations.ml @@ -220,7 +220,7 @@ let eterm_obligations env name evm fs ?status t ty = in let loc, k = evar_source id evm in let status = match k with - | Evar_kinds.QuestionMark (o,_) -> o + | Evar_kinds.QuestionMark { Evar_kinds.qm_obligation=o } -> o | _ -> match status with | Some o -> o | None -> Evar_kinds.Define (not (Program.get_proofs_transparency ())) |