Commit graph

22934 commits

Author SHA1 Message Date
Leonardo de Moura
ffefd8db36 chore: remove weird syntax sugar from macro command
Before this commit,
```
macro term x:term : term => `($x)
```
would generate the notation
```
syntax "term" term : term
```
2020-12-10 08:09:47 -08:00
Sebastian Ullrich
16bdc52088 fix: broken syntax tree from Tactic -> Term conversion
/cc @leodemoura
2020-12-10 10:50:41 +01:00
Leonardo de Moura
0b8edeeadc chore: use double quoted literals 2020-12-09 17:51:01 -08:00
Leonardo de Moura
a07a335c0b chore: update stage0 2020-12-09 17:40:35 -08:00
Leonardo de Moura
ec1e6a68fa feat: elaborate double quoted named literals 2020-12-09 17:35:16 -08:00
Leonardo de Moura
0af806fb49 chore: update stage0 2020-12-09 17:28:44 -08:00
Leonardo de Moura
4d79c00846 feat: add double quoted name literal parser 2020-12-09 17:27:45 -08:00
Leonardo de Moura
29a28254ff chore: update stage0 2020-12-09 17:07:17 -08:00
Leonardo de Moura
a10328e745 chore: simplify syntax patterns using $[...]? 2020-12-09 17:06:19 -08:00
Leonardo de Moura
71735faa33 fix: named argument that depends on missing explicit argument 2020-12-09 16:10:48 -08:00
Leonardo de Moura
25ecc43a84 fix: missing try at isClass? 2020-12-09 15:19:49 -08:00
Leonardo de Moura
1f74759b80 chore: update stage0 2020-12-09 15:06:48 -08:00
Leonardo de Moura
63ab55289e chore: remove "liftable methods"
The new frontend "auto lifting" feature makes them obsolete.
2020-12-09 15:06:07 -08:00
Leonardo de Moura
e899b63def feat: suppress "synthetic sorry" at #check
@Kha The message `sorryAx ?m : ?m` is content free.
2020-12-09 14:17:16 -08:00
Leonardo de Moura
d4f48cbfa3 feat: improve error message "don't know how to synthesize implicit argument" 2020-12-09 14:09:30 -08:00
Leonardo de Moura
7a4b544b1c feat: improve application type mismatch error message
If the type error is at an implicit argument, we annotate
application with `pp.explicit := true`

Given the type incorrect definition
```
def f {a b c : α} : a = c :=
  Eq.trans (a := a) (b := b = c)
```
We now generate the error
```
error: application type mismatch
  @Eq.trans α a (b = c)
argument
  b = c
has type
  Prop
but is expected to have type
  α
```
@Kha Note that we only enable `pp.explicit := true` for the relevant
application. That is, we set `pp.explicit := false` for each children.

Unfortunately, there is a corner case.
```
set_option pp.explicit true
def f {a b c : α} : a = c :=
  Eq.trans (a := a) (b := b = c)
```
produces the error
```
error: application type mismatch
  @Eq.trans α a (b = c)
argument
  @Eq α b c
has type
  Prop
but is expected to have type
  α
```
The reset `pp.explicit := false` overwrote the user option.
I think the simplest solution is the following
1- The delaborator saves the initial set of Options `Init`
2- When it finds a node annotated with a `pp` options, it only
consider the option if it is not set by `Init`.

What do you think?
2020-12-09 13:58:08 -08:00
Leonardo de Moura
095ee9f8d2 chore: missing keywords 2020-12-09 13:58:08 -08:00
Sebastian Ullrich
4390de88b8 chore: CI: ignore Cachix failures 2020-12-09 20:12:20 +01:00
Sebastian Ullrich
a6fca7bced test: fix beginEndAsMacro output 2020-12-09 19:33:11 +01:00
Sebastian Ullrich
5673702687 doc: fix 2020-12-09 19:03:35 +01:00
Sebastian Ullrich
1cb51ba42e fix: precedence of new sepBy shorthands 2020-12-09 19:02:17 +01:00
Sebastian Ullrich
36e924d124 fix: rwRuleSeq 2020-12-09 18:50:04 +01:00
Sebastian Ullrich
f50c8ff495 test: beginEndAsMacro: check error position 2020-12-09 18:13:25 +01:00
Sebastian Ullrich
1de340a8a7 chore: restore old lean4-diff-test-file behavior 2020-12-09 18:05:59 +01:00
Sebastian Ullrich
d9246a8415 chore: adapt to new syntax syntax and introduce a few sepBy shorthands 2020-12-09 18:01:05 +01:00
Sebastian Ullrich
6ed3250e70 chore: update stage0 2020-12-09 17:49:01 +01:00
Sebastian Ullrich
4dfa7e1187 feat: use actual separator in sepBy antiquotation scope 2020-12-09 17:48:05 +01:00
Sebastian Ullrich
7788e75c10 fix: use new sepBy syntax syntax 2020-12-09 17:36:29 +01:00
Sebastian Ullrich
50c7883b56 chore: update stage0 2020-12-09 17:36:29 +01:00
Sebastian Ullrich
fd1f74c421 feat: extend sepBy syntax syntax 2020-12-09 17:36:29 +01:00
Sebastian Ullrich
fdf5c3280e chore: update stage0 2020-12-09 17:36:29 +01:00
Sebastian Ullrich
110b014752 chore: ParserCompiler: strip optParams 2020-12-09 17:36:26 +01:00
Sebastian Ullrich
2afbb2ce42 doc: fix 2020-12-09 11:07:02 +01:00
Sebastian Ullrich
f4267c9bf8 chore: revise Syntax.Traverser changes 2020-12-09 10:38:22 +01:00
Leonardo de Moura
7705769139 doc: default instances and heterogeneous operators 2020-12-08 18:56:30 -08:00
Leonardo de Moura
4d6b80cd51 doc: structures 2020-12-08 16:25:19 -08:00
Leonardo de Moura
14c438234a chore: update stage0 2020-12-08 13:46:11 -08:00
Leonardo de Moura
f2339268b1 fix: adjust code to new match-compiler
In the new frontend,
```lean
@[macroInline] def or : Bool → Bool → Bool
  | true,  _ => true
  | false, b => b
```
is compiled as
```lean
def or (x y : Bool) : Bool :=
  or.match_1 _ x y (fun _ => true) (fun b => b)
```
Thus, the `[macroInline]` attribute does not guarantee that `y` is
evalutated only when `x` is `false`. The new definition does.

This issue was not exposed before because the compiler has an
optimization that float let-decls when they are used in a single
branch.

@Kha We have talked about removing `macroInline`, and defining
functions such as `or` as
```lean
@[inline] def or (x : Bool) (y : Unit -> Bool) : Bool :=
  match x with
  | true  => true
  | false => y ()
```
and define `x || y` as notation for `or x (fun _ => y)`.
I think this is the way to go for polymorphic operators such as `<|>`,
but I am not sure about `or`. New users will probably be puzzled by
it. In particular when they are writing proofs.
2020-12-08 13:46:00 -08:00
Leonardo de Moura
7a014d2ec1 chore: update stage0 2020-12-08 12:42:25 -08:00
Leonardo de Moura
f14826a730 fix: incorrect context used at addDecForDeadParams 2020-12-08 12:38:33 -08:00
Leonardo de Moura
9a422ddc23 fix: Array.back on empty array 2020-12-08 12:21:01 -08:00
Leonardo de Moura
2ebee8d00c fix: missing addJP 2020-12-08 12:09:52 -08:00
Leonardo de Moura
702c258773 fix: index out of bounds
@Kha Please take a look at `Traverser` and check whether the
workaround is appropriate or not.
2020-12-08 11:44:10 -08:00
Leonardo de Moura
6a41d04827 fix: missing panics 2020-12-08 10:36:53 -08:00
Leonardo de Moura
825bc3aa65 doc: array 2020-12-08 10:36:47 -08:00
Leonardo de Moura
ebf4a8877e chore: mark Neg Int as a default instance 2020-12-08 10:09:58 -08:00
Leonardo de Moura
1509a1ab18 doc: builtin types 2020-12-08 10:09:58 -08:00
Sebastian Ullrich
a20f7a2e8e chore: Elab.Quotation: avoid non-builtin syntax 2020-12-08 18:03:21 +01:00
Sebastian Ullrich
037144d3bd refactor: Delaborator.Builtins: eliminate remainder of manual syntax 2020-12-08 17:53:58 +01:00
Sebastian Ullrich
3c9619ed09 feat: Syntax.isNone: return true on missing 2020-12-08 17:33:51 +01:00