feat(library/error_handling/error_handling): set 'pp.beta' to false when displaying errors

see issue #669
This commit is contained in:
Leonardo de Moura 2015-06-12 14:46:51 -07:00
parent 4694f47ea4
commit 7bad9fe554
3 changed files with 23 additions and 1 deletions

View file

@ -15,6 +15,7 @@ Author: Leonardo de Moura
#include "library/parser_nested_exception.h" #include "library/parser_nested_exception.h"
#include "library/generic_exception.h" #include "library/generic_exception.h"
#include "library/flycheck.h" #include "library/flycheck.h"
#include "library/pp_options.h"
#include "library/error_handling/error_handling.h" #include "library/error_handling/error_handling.h"
namespace lean { namespace lean {
@ -144,7 +145,12 @@ static void display_error(io_state_stream const & ios, pos_info_provider const *
} }
} }
void display_error(io_state_stream const & ios, pos_info_provider const * p, throwable const & ex) { void display_error(io_state_stream const & _ios, pos_info_provider const * p, throwable const & ex) {
options opts = _ios.get_options();
// Disable pp.beta to avoid cryptic error messages.
// See issue https://github.com/leanprover/lean/issues/669
opts = opts.update_if_undef(get_pp_beta_name(), false);
io_state_stream ios = _ios.update_options(opts);
flycheck_error err(ios); flycheck_error err(ios);
if (auto k_ex = dynamic_cast<kernel_exception const *>(&ex)) { if (auto k_ex = dynamic_cast<kernel_exception const *>(&ex)) {
display_error(ios, p, *k_ex); display_error(ios, p, *k_ex);

1
tests/lean/669.lean Normal file
View file

@ -0,0 +1 @@
check (λ {T : Prop} (t : T), t) bool.tt

View file

@ -0,0 +1,15 @@
669.lean:1:9: error: type error in placeholder assigned to
bool
placeholder has type
Type₁
but is expected to have type
Prop
the assignment was attempted when trying to solve
type mismatch at application
(λ {T : Prop} (t : T), t) bool.tt
term
bool.tt
has type
bool
but is expected to have type
bool