Commit graph

23 commits

Author SHA1 Message Date
Leonardo de Moura
03e3a1cc6b chore: remove hack
It produces weird error messages in some examples, and it will be
obsolete after the new precedence feature.
2021-03-19 11:09:18 -07:00
Sebastian Ullrich
4772fb5849 feat: delaborator: use if prop 2021-02-02 13:54:34 +01:00
Leonardo de Moura
f73eb1246a feat: add pp.safe_shadowing
When `pp.safe_shadowing` is set to true, we still use the
suggested name if the "body" does not contain a free variable with the
suggested name. This is the approach used in Lean 3, and I think it
improved the result in all affected tests.
The implementation was simple. The only nasty case was `delabAppMatch`.

The main motivation for this feature was hovering information such as
```lean
f : {α_1 : Type} → α_1 → α_1
```
when hovering over the `f` at
```lean
def g (α : Type) (a : α) :=
  f a
```
With `safe_shadowing`, we get the nicer
```lean
f : {α : Type} → α → α
```

cc @Kha
2021-01-15 18:53:25 -08:00
Sebastian Ullrich
d3463ef091 fix: break grouped fill items containing hard line breaks 2020-10-14 14:24:47 +02:00
Sebastian Ullrich
f0dad079ad fix: checkWsBefore.formatter 2020-10-07 10:01:17 +02:00
Sebastian Ullrich
5d76a981b0 chore: adjust pp spacing 2020-10-07 09:44:04 +02:00
Leonardo de Moura
05e5d934d3 feat: change default precedence for new syntax
Now, the following example produces a syntax error.
```lean
macro "foo!" x:term : term => `($x + 1)

check id foo! 10
```

@Kha, I think the heuristic is simple and defensible.
If the new syntax starts and ends with token, than the precedence is
`maxPrec`. Otherwise, it is `leadPrec`.

see #180
2020-09-21 19:04:03 -07:00
Leonardo de Moura
dc9626ceab feat: try to improve weird error message
@Kha Before this commit, we were producing the error "expected command" at the `let` token
```lean
check id let x := 1; x
```
The new error is "expected command, but found term; this error may be
due to parsing precedence levels, consider parenthesizing the term".

The example above looks artificial, but it will happen all the time as
users start to define their own notation.
2020-09-21 18:29:01 -07:00
Sebastian Ullrich
3834a89cdc feat: activate new pretty printer 2020-09-17 08:12:28 -07:00
Sebastian Ullrich
897f277a3e test: strip mvar suffixes 2020-09-15 09:32:00 -07:00
Leonardo de Moura
9151fef49d feat: abstract proofs occurring in binders 2020-09-08 12:29:35 -07:00
Leonardo de Moura
0a853b2c44 feat: abstract nested proofs in definitions 2020-09-08 11:59:26 -07:00
Leonardo de Moura
d8855c2673 feat: elaborate all definitions using elabMutualDef 2020-09-06 07:23:47 -07:00
Leonardo de Moura
fe27eab6f1 chore: fix tests
Metavariables are not being purified anymore
2020-08-04 18:55:26 -07:00
Leonardo de Moura
6f8dbb4506 chore: fix test 2020-06-17 21:32:31 -07:00
Leonardo de Moura
82780be144 chore: fix tests 2020-06-17 21:28:37 -07:00
Sebastian Ullrich
0f0f1407af chore: fix test 2020-06-17 18:07:44 +02:00
Leonardo de Moura
bc6dba89f3 chore: fix tests 2020-06-15 14:39:30 -07:00
Leonardo de Moura
25c1986439 chore: fix tests 2020-06-09 14:11:34 -07:00
Leonardo de Moura
f46dcd7a13 chore: fix some tests 2020-06-08 16:12:06 -07:00
Leonardo de Moura
c6ea675cae chore: fix test
@Kha The error message changed. Not sure the new one is expected. It
is due to the change in `trailingLoop`. We can discuss it in the next
meeting.
2020-06-08 16:12:05 -07:00
Sebastian Ullrich
ed14375dad feat: sort and deduplicate "expected" tokens in parser error messages 2020-03-19 17:17:08 -07:00
Leonardo de Moura
63434fbb7d chore: add parser tests 2020-02-04 10:11:50 -08:00