Skip to content
Snippets Groups Projects
Commit 52547f53 authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

Improve error messages for sel/spec/intro pat.

parent b470f38b
No related branches found
No related tags found
No related merge requests found
...@@ -136,23 +136,32 @@ Ltac parse s := ...@@ -136,23 +136,32 @@ Ltac parse s :=
| intro_pat => constr:([s]) | intro_pat => constr:([s])
| list string => | list string =>
lazymatch eval vm_compute in (mjoin <$> mapM parse s) with lazymatch eval vm_compute in (mjoin <$> mapM parse s) with
| Some ?pats => pats | _ => fail "intro_pat.parse: cannot parse" s | Some ?pats => pats
| _ => fail "intro_pat.parse: cannot parse" s "as an introduction pattern"
end end
| string => | string =>
lazymatch eval vm_compute in (parse s) with lazymatch eval vm_compute in (parse s) with
| Some ?pats => pats | _ => fail "intro_pat.parse: cannot parse" s | Some ?pats => pats
| _ => fail "intro_pat.parse: cannot parse" s "as an introduction pattern"
end end
| ident => constr:([IIdent s]) | ident => constr:([IIdent s])
| ?X => fail "intro_pat.parse:" s "has unexpected type" X | ?X => fail "intro_pat.parse: the term" s
"is expected to be an introduction pattern"
"(usually a string),"
"but has unexpected type" X
end. end.
Ltac parse_one s := Ltac parse_one s :=
lazymatch type of s with lazymatch type of s with
| intro_pat => s | intro_pat => s
| string => | string =>
lazymatch eval vm_compute in (parse s) with lazymatch eval vm_compute in (parse s) with
| Some [?pat] => pat | _ => fail "intro_pat.parse_one: cannot parse" s | Some [?pat] => pat
| _ => fail "intro_pat.parse_one: cannot parse" s "as an introduction pattern"
end end
| ?X => fail "intro_pat.parse_one:" s "has unexpected type" X | ?X => fail "intro_pat.parse_one: the term" s
"is expected to be an introduction pattern"
"(usually a string),"
"but has unexpected type" X
end. end.
End intro_pat. End intro_pat.
...@@ -176,5 +185,8 @@ Ltac intro_pat_intuitionistic p := ...@@ -176,5 +185,8 @@ Ltac intro_pat_intuitionistic p :=
eval cbv in (forallb intro_pat_intuitionistic pat) eval cbv in (forallb intro_pat_intuitionistic pat)
| ident => false | ident => false
| bool => p | bool => p
| ?X => fail "intro_pat_intuitionistic:" p "has unexpected type" X | ?X => fail "intro_pat_intuitionistic: the term" p
"is expected to be an introduction pattern"
"(usually a string),"
"but has unexpected type" X
end. end.
...@@ -37,8 +37,12 @@ Ltac parse s := ...@@ -37,8 +37,12 @@ Ltac parse s :=
| list string => eval vm_compute in (SelIdent INamed <$> s) | list string => eval vm_compute in (SelIdent INamed <$> s)
| string => | string =>
lazymatch eval vm_compute in (parse s) with lazymatch eval vm_compute in (parse s) with
| Some ?pats => pats | _ => fail "invalid sel_pat" s | Some ?pats => pats
| _ => fail "sel_pat.parse: cannot parse" s "as a selection pattern"
end end
| ?X => fail "sel_pat.parse:" s "has unexpected type" X | ?X => fail "sel_pat.parse: the term" s
"is expected to be a selection pattern"
"(usually a string),"
"but has unexpected type" X
end. end.
End sel_pat. End sel_pat.
...@@ -92,10 +92,15 @@ Ltac parse s := ...@@ -92,10 +92,15 @@ Ltac parse s :=
lazymatch type of s with lazymatch type of s with
| list spec_pat => s | list spec_pat => s
| spec_pat => constr:([s]) | spec_pat => constr:([s])
| string => lazymatch eval vm_compute in (parse s) with | string =>
| Some ?pats => pats | _ => fail "spec_pat.parse: cannot parse" s lazymatch eval vm_compute in (parse s) with
end | Some ?pats => pats
| _ => fail "spec_pat.parse: cannot parse" s "as a specialization pattern"
end
| ident => constr:([SIdent s []]) | ident => constr:([SIdent s []])
| ?X => fail "spec_pat.parse:" s "has unexpected type" X | ?X => fail "spec_pat.parse: the term" s
"is expected to be a specialization pattern"
"(usually a string),"
"but has unexpected type" X
end. end.
End spec_pat. End spec_pat.
...@@ -730,11 +730,15 @@ Use [iApply fupd_mask_intro] to introduce mask-changing update modalities". ...@@ -730,11 +730,15 @@ Use [iApply fupd_mask_intro] to introduce mask-changing update modalities".
"iRevert_wrong_sel_pat" "iRevert_wrong_sel_pat"
: string : string
The command has indeed failed with message: The command has indeed failed with message:
Tactic failure: sel_pat.parse: n has unexpected type nat. Tactic failure: sel_pat.parse: the term n
is expected to be a selection pattern (usually a string),
but has unexpected type nat.
"iInduction_wrong_sel_pat" "iInduction_wrong_sel_pat"
: string : string
The command has indeed failed with message: The command has indeed failed with message:
Tactic failure: sel_pat.parse: m has unexpected type nat. Tactic failure: sel_pat.parse: the term m
is expected to be a selection pattern (usually a string),
but has unexpected type nat.
"test_pure_name" "test_pure_name"
: string : string
1 goal 1 goal
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment