chore(library/tactic/cases_tactic): add a bit more information to error message

This commit is contained in:
Gabriel Ebner 2017-07-18 09:04:47 +01:00
parent 317319ded3
commit e94095cdf3
3 changed files with 17 additions and 3 deletions

View file

@ -440,9 +440,8 @@ struct cases_tactic_fn {
auto s = mk_tactic_state(mvar);
throw cases_tactic_exception {
tactic::mk_exception([=] () {
return format("cases tactic failed, unsupported equality") + line()
+ format("(only equalities between constructors and/or variables are") + line()
+ format("supported, try cases on the indices):") + line()
return format("cases tactic failed, unsupported equality between type and constructor indices") + line()
+ format("(only equalities between constructors and/or variables are supported, try cases on the indices):") + line()
+ s.pp_expr(H_type) + line();
}, s)
};

View file

@ -0,0 +1,6 @@
inductive foo : → Type
| a : foo 0
| b : ∀ n, foo (n+1)
example (n) (f : ) (h : foo (f n)) : true :=
by cases h

View file

@ -0,0 +1,9 @@
cases_unsupported_equality.lean:6:3: error: cases tactic failed, unsupported equality between type and constructor indices
(only equalities between constructors and/or variables are supported, try cases on the indices):
f n = 0
state:
n : ,
f : ,
h : foo (f n)
⊢ f n = 0 → h == foo.a → true