Commit graph

1123 commits

Author SHA1 Message Date
Leonardo de Moura
d1ad5eb51a chore: add workarounds 2020-10-15 14:56:38 -07:00
Leonardo de Moura
7d083a7451 chore: move to new frontend 2020-10-15 14:49:23 -07:00
Leonardo de Moura
6c6f3dca87 chore: cleanup 2020-10-15 14:29:27 -07:00
Leonardo de Moura
8753a45452 chore: move to new frontend 2020-10-15 14:19:06 -07:00
Leonardo de Moura
827625a377 perf: add temporary hack for performance issue
The compiler frontend implemented in C++ is eagerly inlining local
functions. The new test would take an absurd amount of time without
the new hack.
We remove this hack when we re-implement the compiler frontend in Lean.
2020-10-15 13:37:29 -07:00
Leonardo de Moura
908e5f7acd fix: elabDiscrsWitMatchType 2020-10-15 11:00:33 -07:00
Leonardo de Moura
883e07a65f chore: remove unnecessary annotation 2020-10-15 10:50:48 -07:00
Leonardo de Moura
bdaf648667 fix: synthesizeSyntheticMVarsNoPostponing at elabMatch 2020-10-15 10:44:16 -07:00
Leonardo de Moura
755d9dedbe chore: move to new frontend 2020-10-15 10:44:16 -07:00
Leonardo de Moura
0ee5e81513 chore: use #lang lean4 2020-10-15 10:44:16 -07:00
Leonardo de Moura
6a7e997534 chore: improve error message 2020-10-15 10:44:16 -07:00
Sebastian Ullrich
b0df2be65c chore: remove old pretty printer 2020-10-15 12:04:55 +02:00
Leonardo de Moura
38c79298ed chore: cleanup 2020-10-14 17:56:52 -07:00
Leonardo de Moura
64ea6f3bc7 chore: move to new frontend 2020-10-14 17:45:57 -07:00
Leonardo de Moura
95cb76ddb7 chore: move to new frontend 2020-10-14 17:44:06 -07:00
Leonardo de Moura
9a3d785ae3 chore: move to new frontend 2020-10-14 17:38:17 -07:00
Leonardo de Moura
43efdd50f7 chore: move to new frontend 2020-10-14 17:38:17 -07:00
Leonardo de Moura
7be77fb189 chore: move to new frontend 2020-10-14 17:38:17 -07:00
Leonardo de Moura
c84a9f8a0b chore: move to new frontend 2020-10-14 17:38:17 -07:00
Leonardo de Moura
abed742984 chore: cleanup 2020-10-14 17:38:17 -07:00
Leonardo de Moura
8347dd5826 chore: move to new frontend 2020-10-14 17:38:17 -07:00
Leonardo de Moura
3b34a150ff chore: use #lang lean4 2020-10-14 17:38:17 -07:00
Leonardo de Moura
36220b785e feat: make new frontend compatible with lean4-mode 2020-10-14 13:20:01 -07:00
Leonardo de Moura
cfa02bf16a chore: add missing : 2020-10-14 13:20:01 -07:00
Leonardo de Moura
5d3e08d43a chore: documented modification needed to enable the elaboration of commands containing syntax errors
cc @Kha
2020-10-14 13:20:01 -07:00
Leonardo de Moura
1afc33278c refactor: use StateRefT at Frontend 2020-10-14 13:20:01 -07:00
Sebastian Ullrich
f4ffebf01c feat: delaborator: use nicer binder name for [anonymous]
Fixes #193
2020-10-14 18:38:59 +02:00
Sebastian Ullrich
a3f216967e fix: make Format.be tail recursive again 2020-10-14 17:23:51 +02:00
Leonardo de Moura
caac09b33e fix: forgot to reset params on block following joinpoint declaration 2020-10-14 07:41:35 -07:00
Sebastian Ullrich
d3463ef091 fix: break grouped fill items containing hard line breaks 2020-10-14 14:24:47 +02:00
Sebastian Ullrich
2ccd382e6f refactor: formatter: remove unnecessary concatenation 2020-10-14 14:24:47 +02:00
Sebastian Ullrich
1f772aaa6c fix: Format.be: count space in front of fill item 2020-10-14 14:24:47 +02:00
Sebastian Ullrich
af78e6cc18 refactor: Format.be: reuse pushGroup in line case 2020-10-14 14:24:47 +02:00
Sebastian Ullrich
8c2953400d perf: formatter: smaller Format objects 2020-10-14 14:24:47 +02:00
Sebastian Ullrich
78ffc72150 chore: remove ppGroups beneficial only for group but not fill 2020-10-14 14:24:47 +02:00
Sebastian Ullrich
381db5265a refactor: monadify Format.be 2020-10-14 14:24:47 +02:00
Sebastian Ullrich
121b956bb4 refactor: make more internal Format stuff private 2020-10-14 14:24:47 +02:00
Sebastian Ullrich
7e5cd0d171 fix: Format.be: respect indent when trying to fit fill item in a new line 2020-10-14 14:24:47 +02:00
Sebastian Ullrich
88af639346 feat: Formatter: default to Format.fill instead of Format.group 2020-10-14 14:24:47 +02:00
Leonardo de Moura
08061137a8 chore: move to new frontend 2020-10-13 19:00:40 -07:00
Leonardo de Moura
1f09fc2c77 chore: move to new frontend 2020-10-13 17:18:15 -07:00
Leonardo de Moura
b7658ef91f chore: move to new frontend 2020-10-13 17:11:52 -07:00
Leonardo de Moura
d3a22397b4 chore: move to new frontend 2020-10-13 16:38:25 -07:00
Leonardo de Moura
91ae7a274a chore: cleanup 2020-10-13 16:25:06 -07:00
Leonardo de Moura
faeba23099 chore: cleanup 2020-10-13 16:09:00 -07:00
Leonardo de Moura
c1dccb8154 feat: stx[i] as notation for stx.getArg i 2020-10-13 15:48:39 -07:00
Leonardo de Moura
427a3610c3 chore: move to new frontend 2020-10-13 15:36:39 -07:00
Leonardo de Moura
9af0a0e18b feat: add withReader method
@Kha `withReader` is a well-behaved version of `adaptReader`. `adaptReader` is
too general, and it often produces counterintuitive elaboration
errors.

Here are two super annoying issues I hit all the time:
1- `adaptReader` + polymorphic code
```
def ex1 : ReaderT Nat IO Unit :=
adaptReader (fun x => x + 1) $
  IO.println "foo" -- 3 Errors here failed to synthesize `Monad ?m` and  `MonadIO ?m`, and don't know how to synthesize `Type → Type`
```

2- `adaptReader` and notation that requires the expected type
```
structure Context :=
(x y : Nat)

def ex2 : ReaderT Context IO Nat :=
adaptReader (fun s => { s with x := 10 }) $ -- Error at the structure instance
  ...
```
In the example above, I have to write `fun (s : Context) => ...` to
fix the problem.

The two problems above happen in the old and new frontends. However,
there is a new problem specific for the new frontend. In the new
frontend, a `do` is only elaborated when the expected type is known.
So, `adaptReader (fun ctx => ...) do ...` seldom works :(

As I said above, the issue is that `adaptReader` is too general. Its
type is
```
  {ρ ρ' : Type u_1} → {m m' : Type u_1 → Type u_2} → [MonadReaderAdapter ρ ρ' m m'] → {α : Type u_1} → (ρ' → ρ) → m α → m' α
```

`withReader` is a simpler version of `adaptReader`
```
withReader : {ρ : Type u_1} → {m : Type u_1 → Type u_2} → [MonadWithReader ρ m] → {α : Type u_1} → (ρ → ρ) → m α → m α
```
It doesn't have any of the problems above. Moreover, I managed to replace
every single instance of `adaptReader` with `withReader` at the stdlib
and tests. We don't need the `adaptReader` generality.
2020-10-13 15:00:17 -07:00
Leonardo de Moura
4fce06c468 chore: move to new frontend 2020-10-13 14:13:33 -07:00
Leonardo de Moura
d10b95d2ad chore: move to new frontend 2020-10-13 13:23:35 -07:00