fix(frontends/lean/pp): implicit arguments in notation
This commit is contained in:
parent
85339c0cc1
commit
eef1cc4ac2
3 changed files with 11 additions and 3 deletions
|
@ -653,12 +653,12 @@ static unsigned get_some_precedence(token_table const & t, name const & tk) {
|
|||
}
|
||||
|
||||
auto pretty_fn::pp_notation_child(expr const & e, unsigned lbp, unsigned rbp) -> result {
|
||||
if (is_app(e) && !m_coercion && is_coercion(m_env, get_app_fn(e))) {
|
||||
if (is_app(e) && is_implicit(app_fn(e))) {
|
||||
return pp_notation_child(app_fn(e), lbp, rbp);
|
||||
} else if (is_app(e) && !m_coercion && is_coercion(m_env, get_app_fn(e))) {
|
||||
return pp_coercion(e, rbp);
|
||||
} else {
|
||||
result r = pp(e);
|
||||
// std::cout << "e: " << e << "\n";
|
||||
// std::cout << "lbp: " << lbp << ", rbp: " << rbp << ", r.lbp(): " << r.lbp() << ", r.rbp(): " << r.rbp() << "\n\n";
|
||||
if (r.rbp() < lbp || r.lbp() <= rbp) {
|
||||
return result(paren(r.fmt()));
|
||||
} else {
|
||||
|
|
5
tests/lean/notation2.lean
Normal file
5
tests/lean/notation2.lean
Normal file
|
@ -0,0 +1,5 @@
|
|||
import data.list data.num
|
||||
open list
|
||||
|
||||
check 1 :: 2 :: nil
|
||||
check 1 :: 2 :: 3 :: 4 :: 5 :: nil
|
3
tests/lean/notation2.lean.expected.out
Normal file
3
tests/lean/notation2.lean.expected.out
Normal file
|
@ -0,0 +1,3 @@
|
|||
notation2.lean:2:0: warning: imported file uses 'sorry'
|
||||
1 :: 2 :: nil : list num
|
||||
1 :: 2 :: 3 :: 4 :: 5 :: nil : list num
|
Loading…
Reference in a new issue