Commit graph

24104 commits

Author SHA1 Message Date
Sebastian Ullrich
99d8e34a51 feat: server: highlight variables & field notation 2021-03-16 16:41:32 -07:00
Sebastian Ullrich
8a5344ed17 fix: server: handle requests for closed files 2021-03-16 16:41:32 -07:00
Sebastian Ullrich
002efd0db6 chore: server: exclude some nodes from semantic highlighting 2021-03-16 16:41:32 -07:00
Sebastian Ullrich
0e8272388d fix: server: semantic highlighting with multiple tokens in a line 2021-03-16 16:41:32 -07:00
Sebastian Ullrich
cb5050bb7f doc: Syntax.topDown 2021-03-16 16:41:32 -07:00
Sebastian Ullrich
ddff87f7f5 feat: server: also implement full semantic token requests
because lsp-mode freaks out without them
2021-03-16 16:41:32 -07:00
Sebastian Ullrich
5df753f338 feat: server: support ranged semantic tokens (keywords only for now) 2021-03-16 16:41:32 -07:00
Leonardo de Moura
89797c4485 chore: improve congrDefault
We don't need `congrMatch` anymore.
2021-03-16 15:59:11 -07:00
Leonardo de Moura
8227d3afcd feat: support for simplifying match discriminants 2021-03-16 15:51:36 -07:00
Leonardo de Moura
2970c6ca79 feat: add mkCongrDepArg and mkCongrDep 2021-03-16 15:40:48 -07:00
Leonardo de Moura
0fd9b493fa chore: add helper congruence lemma 2021-03-16 15:40:28 -07:00
Leonardo de Moura
ea91317f1a fix: avoid nontermination due to respecialization 2021-03-15 19:12:57 -07:00
Leonardo de Moura
cc0712fc82 feat: add support for offset terms at DiscrTree 2021-03-14 08:23:44 -07:00
Sebastian Ullrich
75a97fad94 feat: nicer token parse errors 2021-03-14 08:23:32 -07:00
Sebastian Ullrich
9f21d6fd64 fix: preserve token parse errors 2021-03-14 08:23:32 -07:00
Sebastian Ullrich
048d592fe8 fix: FileMap out of bounds 2021-03-14 08:23:32 -07:00
Leonardo de Moura
12aa5cc461 chore: avoid ! in keywords 2021-03-13 17:24:27 -08:00
Leonardo de Moura
e04e9ff87e feat: extend anonymous ctor notation 2021-03-13 17:11:37 -08:00
Leonardo de Moura
c54a7c8ccc chore: make HasEquiv more general 2021-03-13 07:02:35 -08:00
Sebastian Ullrich
d35fc280d2 refactor: further refactor Lean.Elab.Syntax 2021-03-13 14:47:59 +01:00
Sebastian Ullrich
00a0db4231 fix: unexpanders should inherit scopedness 2021-03-13 13:20:12 +01:00
Sebastian Ullrich
8f824ce141 fix: KeyedDeclsAttribute: preserve scopedness 2021-03-13 13:18:04 +01:00
Sebastian Ullrich
d88ef52b68 feat: scoped KeyedDeclsAttribute 2021-03-13 12:40:58 +01:00
Leonardo de Moura
5c24906c60 fix: Delaborator for constants
@Kha Could you please take a look at the fix?
This is an example posted by @JasonGross on Zulip.
2021-03-12 19:51:27 -08:00
Leonardo de Moura
a30a256123 refactor: remove Tactic/Binders.lean
These macro expansion functions can be now implemented using `macro` and `macro_rules`.
2021-03-12 17:59:21 -08:00
Leonardo de Moura
50fd39db89 fix: bug at allGoals 2021-03-12 17:48:33 -08:00
Leonardo de Moura
1df84e3a6d feat: allow haveDecl, sufficesDecl, letRecDecls in antiquotations 2021-03-12 17:40:16 -08:00
Leonardo de Moura
d330f1e2e2 feat: rotateLeft and rotateRight tactics 2021-03-12 17:13:03 -08:00
Leonardo de Moura
27e15961cd fix: no coercions at exact and refine 2021-03-12 17:12:25 -08:00
Leonardo de Moura
091fadbf64 feat: add List.rotateLeft and List.rotateRight 2021-03-12 17:09:22 -08:00
Leonardo de Moura
3d58c4d115 chore: remove old notation 2021-03-12 15:05:06 -08:00
Leonardo de Moura
bf8119a5cd chore: convert keywords to snake_case
Again `!` is only for functions that can panic.
2021-03-12 13:34:51 -08:00
Leonardo de Moura
472c5fb900 fix: indentation issues 2021-03-12 11:09:28 -08:00
Leonardo de Moura
df994fd16f fix: add checkColGe to matchAlt
@Kha this is a fix for the example that @gebner posted on Zulip.
There are other possible workarounds, but I think this one is
"intuitive".

Here is the problem description and workaround.
We currently use the `withPosition` combinator at `matchAlts`. The
original motivation was nested `match`-expressions without
parenthesis.
We also have the `checkColGt` in the application parser.

Thus, `frob 5` is not parsed as an application. That is, the term
parser after the `then` keyword stops at `frob`.
Then, we get the weird "expected 'else'" error message at `5` :)

In this commit, I add a `checkColGe` check at the beginning of each
alternative right-hand-side.

The effect on the stdlib was minimal. It basically affected old code
that used the Lean 3 workaround for partial functions
```
partial def f : N -> N | i =>
  ...
```
In Lean 4, we can use the more natural
```
partial def f (i : N) : N :=
...
```
or
```
partial def f : N -> N := fun i =>
...
```

It also affected code such as
```
instance : Repr String.Iterator where
  reprPrec | ⟨s, pos⟩, prec =>
    Repr.addAppParen ("String.Iterator.mk " ++ reprArg s ++ " " ++ reprArg pos) prec
```
This is a workaround for a missing feature. We really wanted to write
```
instance : Repr String.Iterator where
  reprPrec ⟨s, pos⟩ prec :=
    Repr.addAppParen ("String.Iterator.mk " ++ reprArg s ++ " " ++ reprArg pos) prec
```
2021-03-12 11:06:07 -08:00
Leonardo de Moura
25f1980ddd fix: fixes #345 2021-03-11 18:59:39 -08:00
Leonardo de Moura
865316bbf9 feat: improve error message when stuck solving universe constraints
closes #343
2021-03-11 17:46:44 -08:00
Leonardo de Moura
dc87bef04c fix: error message
This is a fix for bug reported by @JasonGross at Zulip
2021-03-11 12:16:15 -08:00
Leonardo de Moura
be841a7cad chore: throwError! => throwError, throwErrorAt! => throwErrorAt
@Kha I marked the corresponding methods as `protected`.
I currently can't stand `throw_error`, and I am optimistic about
server highlighting feature you are working on :)
2021-03-11 11:59:45 -08:00
Leonardo de Moura
ffb57e661f chore: remove old notation 2021-03-11 11:24:52 -08:00
Leonardo de Moura
1112ab6eff chore: use new notation 2021-03-11 11:19:33 -08:00
Leonardo de Moura
ca0baf12b6 chore: avoid ! suffix in builtin notation 2021-03-11 10:58:06 -08:00
Leonardo de Moura
5049d92968 chore: remove let! and let* notation 2021-03-11 10:42:50 -08:00
Leonardo de Moura
e7140959c4 chore: add elaborator for let_fun and let_delayed 2021-03-11 10:40:25 -08:00
Leonardo de Moura
a97bdd6a67 chore: add let_delayed and let_fun notation
They will replace `let*` and `let!`
2021-03-11 10:31:04 -08:00
Leonardo de Moura
164577d94e chore: remove parser! and tparser!
The new macros are called "leading_parser` and `trailing_parser`.

cc @Kha
2021-03-11 09:36:58 -08:00
Leonardo de Moura
0af0957af4 chore: add leading_parser and trailing_parser elaborator 2021-03-11 09:19:10 -08:00
Leonardo de Moura
327717ade8 chore: add leading_parser and trailing_parser notation
It will replace `parser!` and `tparser!`
2021-03-11 09:08:35 -08:00
Leonardo de Moura
9f88ea8047 chore: remove old decide!, nativeRefl!, and nativeDecide! 2021-03-11 08:06:20 -08:00
Leonardo de Moura
babdde9068 chore: activate decide and nativeDecide 2021-03-11 07:54:54 -08:00
Leonardo de Moura
90c5f35702 refactor: implement decide and nativeDecide as tactics
TODO: update stage0 and activate
2021-03-11 07:50:54 -08:00