diff --git a/src/frontends/lean/pp.cpp b/src/frontends/lean/pp.cpp index e9ccc73422..4b326a47cc 100644 --- a/src/frontends/lean/pp.cpp +++ b/src/frontends/lean/pp.cpp @@ -521,16 +521,9 @@ auto pretty_fn::pp_overriden_local_ref(expr const & e) -> result { return result(max_bp()-1, r_fmt); } -bool pretty_fn::ignore_local_ref(expr const & e) { - expr const & fn = get_app_fn(e); - return m_full_names && (!is_constant(fn) || !const_name(fn).is_atomic()); -} - // Return some result if \c e is of the form (c p_1 ... p_n) where // c is a constant, and p_i's are parameters fixed in a section. auto pretty_fn::pp_local_ref(expr const & e) -> optional { - if (ignore_local_ref(e)) - return optional(); unsigned num_ref_univ_params; switch (check_local_ref(m_env, e, num_ref_univ_params)) { case NotLocalRef: @@ -749,7 +742,7 @@ auto pretty_fn::pp_app(expr const & e) -> result { bool ignore_hide = true; result res_fn = pp_child(fn, max_bp()-1, ignore_hide); format fn_fmt = res_fn.fmt(); - if (m_implict && (!is_app(fn) || (!ignore_local_ref(fn) && is_local_ref(m_env, fn))) && has_implicit_args(fn)) + if (m_implict && (!is_app(fn) || (is_local_ref(m_env, fn))) && has_implicit_args(fn)) fn_fmt = compose(*g_explicit_fmt, fn_fmt); result res_arg = pp_child(app_arg(e), max_bp()); return result(max_bp()-1, group(compose(fn_fmt, nest(m_indent, compose(line(), res_arg.fmt()))))); diff --git a/src/frontends/lean/pp.h b/src/frontends/lean/pp.h index 5882cfa8aa..4e7d68b452 100644 --- a/src/frontends/lean/pp.h +++ b/src/frontends/lean/pp.h @@ -107,7 +107,6 @@ private: std::pair needs_space_sep(token_table const * t, std::string const &s1, std::string const &s2) const; result pp_overriden_local_ref(expr const & e); - bool ignore_local_ref(expr const & e); optional pp_local_ref(expr const & e); result pp_hide_coercion(expr const & e, unsigned bp, bool ignore_hide = false); diff --git a/tests/lean/634.lean b/tests/lean/634.lean index 5ff60981bb..1bdfce80c1 100644 --- a/tests/lean/634.lean +++ b/tests/lean/634.lean @@ -7,11 +7,11 @@ section set_option pp.implicit true check @A n set_option pp.full_names true - check @foo.A X n + check @foo.A n check @A n set_option pp.full_names false - check @foo.A X n + check @foo.A n check @A n end end foo diff --git a/tests/lean/634.lean.expected.out b/tests/lean/634.lean.expected.out index 111dcb3987..d611f8123d 100644 --- a/tests/lean/634.lean.expected.out +++ b/tests/lean/634.lean.expected.out @@ -1,5 +1,5 @@ @A n : Type -@foo.A X n : Type -@foo.A X n : Type +@foo.A n : Type +@foo.A n : Type @A n : Type @A n : Type diff --git a/tests/lean/634b.lean b/tests/lean/634b.lean index d841392ba9..f675030785 100644 --- a/tests/lean/634b.lean +++ b/tests/lean/634b.lean @@ -6,36 +6,36 @@ section definition B : Type := X variable {n : ℕ} check @A n - check foo.A nat - check foo.A (X × B) - check @foo.A (X × B) 10 - check @foo.A (@foo.B (@A n)) n - check @foo.A (@foo.B (@foo.A X n)) n - check @foo.A (@foo.B (@foo.A nat n)) n + check foo.A + check foo.A + check @foo.A 10 + check @foo.A n + check @foo.A n + check @foo.A n set_option pp.full_names true check A - check foo.A nat - check @foo.A (X × B) 10 - check @foo.A (@foo.B (@foo.A X n)) n - check @foo.A (@foo.B (@foo.A nat n)) n + check foo.A + check @foo.A 10 + check @foo.A n + check @foo.A n set_option pp.full_names false set_option pp.implicit true check @A n - check @foo.A nat 10 - check @foo.A X n + check @foo.A 10 + check @foo.A n set_option pp.full_names true - check @foo.A X n + check @foo.A n check @A n set_option pp.full_names false - check @foo.A X n - check @foo.A B n - check @foo.A (@foo.B (@A n)) n - check @foo.A (@foo.B (@foo.A X n)) n - check @foo.A (@foo.B (@foo.A nat n)) n + check @foo.A n + check @foo.A n + check @foo.A n + check @foo.A n + check @foo.A n check @A n end end foo diff --git a/tests/lean/634b.lean.expected.out b/tests/lean/634b.lean.expected.out index 1d798e7c43..2ff1762fc3 100644 --- a/tests/lean/634b.lean.expected.out +++ b/tests/lean/634b.lean.expected.out @@ -1,23 +1,23 @@ A : Type -foo.A ℕ : Type -foo.A (X × B) : Type -foo.A (X × B) : Type -foo.A (foo.B A) : Type -foo.A (foo.B A) : Type -foo.A (foo.B (foo.A ℕ)) : Type -foo.A X : Type -foo.A ℕ : Type -foo.A (X × foo.B X) : Type -foo.A (foo.B (foo.A X)) : Type -foo.A (foo.B (foo.A ℕ)) : Type +A : Type +A : Type +A : Type +A : Type +A : Type +A : Type +foo.A : Type +foo.A : Type +foo.A : Type +foo.A : Type +foo.A : Type +@A n : Type +@A 10 : Type +@A n : Type +@foo.A n : Type +@foo.A n : Type +@A n : Type +@A n : Type @A n : Type -@foo.A ℕ 10 : Type @A n : Type -@foo.A X n : Type -@foo.A X n : Type @A n : Type -@foo.A B n : Type -@foo.A (foo.B (@A n)) n : Type -@foo.A (foo.B (@A n)) n : Type -@foo.A (foo.B (@foo.A ℕ n)) n : Type @A n : Type diff --git a/tests/lean/elab_meta2.lean b/tests/lean/elab_meta2.lean index 61eabd8e23..a8484d3cdd 100644 --- a/tests/lean/elab_meta2.lean +++ b/tests/lean/elab_meta2.lean @@ -1,4 +1,3 @@ - print "parametric meta definition" meta definition f {A : Type} : nat → A → A → A | n a b := if n / 2 = 0 then a else f (n / 2) b a @@ -19,9 +18,8 @@ print "meta definition inside parametric scope" parameter {A : Type} meta definition bah : nat → A → A → A | n a b := if n / 2 = 0 then a else bah (n / 2) b a -vm_eval - if foo.bah 10 1 2 = 2 then "OK" else "FAILED" end +vm_eval if foo.bah 10 1 2 = 2 then "OK" else "FAILED" end foo print "private meta definition" diff --git a/tests/lean/local_ref_bugs.lean.expected.out b/tests/lean/local_ref_bugs.lean.expected.out index c71f947d36..c8338fd143 100644 --- a/tests/lean/local_ref_bugs.lean.expected.out +++ b/tests/lean/local_ref_bugs.lean.expected.out @@ -1,15 +1,15 @@ -foo.b α : foo -foo.b α : foo -foo.b α : foo +foo.b : foo +foo.b : foo +foo.b : foo ------- -foo.b α +foo.b foo ------- α : Type ⊢ foo -bla.foo.b α : bla.foo α -bla.foo.b α : bla.foo α -bla.foo.b α : bla.foo α -boo.foo.b α : boo.foo α -boo.foo.b α : boo.foo α -boo.foo.b α : boo.foo α +bla.foo.b : bla.foo +bla.foo.b : bla.foo +bla.foo.b : bla.foo +boo.foo.b : boo.foo +boo.foo.b : boo.foo +boo.foo.b : boo.foo