Commit graph

13 commits

Author SHA1 Message Date
Kim Morrison
dcea47db02
chore: shorten suggestion about diagnostics (#4882)
This message is often incorporated into source files via `#guard_msgs`.
This change ensures it won't go over the 100 character ruler, and I
think is equally grammatical. :-)
2024-07-31 17:56:43 +00:00
Kyle Miller
d5e7dbad80
fix: make "use `set_option diagnostics true" message conditional on current setting (#4781)
It is confusing that the message suggesting to use the `diagnostics`
option is given even when the option is already set. This PR makes use
of lazy message data to make the message contingent on the option being
false.

It also tones down the promise that there is any diagonostic information
available, since sometimes there is nothing to report.

Suggested by Johan Commelin.
2024-07-31 03:53:09 +00:00
Leonardo de Moura
ff0d338dd2
feat: improve error messages for numerals (#4368)
closes #4365
2024-06-06 00:28:42 +00:00
Leonardo de Moura
de5e039c83
fix: type class issues with maxSynthPendingDepth := 1 (#4119)
Summary:

- Take `synthPendingDepth` into account when caching TC results
- Add `maxSynthPendingDepth` option with default := 2.
- Add support for tracking `synthPending` failures when using
`set_option diagnostics true`

closes #2522
closes #3313
closes #3927

Identical to #4114  but with `maxSynthPendingDepth := 1`

closes #4114 

cc @semorrison
2024-05-14 03:03:32 +00:00
Leonardo de Moura
483f32edd8 feat: in pure code, do use assume Id monad at do notation
This feature produced counterintuitive behavior and confused users.
See discussion at #770.

As pointed out by @tydeu, it is not too much work to write `Id.run <|`
before the `do` when we want to use the `do` notation in pure code.

closes #770
2021-12-10 12:55:14 -08:00
Leonardo de Moura
99e8a98f06 feat: allow universes metavariables from any depth to be assigned when ignoreLevelDepth is true
We set `ignoreLevelDepth` to true during type class resolution.
2021-08-18 20:20:51 -07:00
Leonardo de Moura
c37d961fc3 chore: make sure both alternatives use throwError 2021-03-16 17:20:00 -07:00
Leonardo de Moura
25f1980ddd fix: fixes #345 2021-03-11 18:59:39 -08:00
Leonardo de Moura
f321ad213f fix: reset set of stuck mvars after reporting they are stuck
This bug produced the doubled error message at issue #337
2021-03-08 12:46:50 -08:00
Leonardo de Moura
0c1c6c0a73 feat: convert universe metavariables into parameters after elaborating theorem header
closes #318

Like Lean 3, we are doing it only for theorems.
@Kha, we talked about doing it for definitions too, it sounded like a
good idea, and it would make the system's behavior more uniform, but
unfortunately it creates too many problems. There are so many trivial
cases where it breaks. Here are some examples.

1- Definitions that take multiple bundled structures
```
def foo (s1 : Group) (s2 : CommRing) ...
```
They are universe polymorphic, and the different structures must be in
the same universe, but we don't know it when we elaborate the header,
that is, we need to elaborate the body.

An extreme case is `PUnit` occurring in the header. It is universe
polymorphic, but we only lear the constraints on this universe after
we elaborate the body.

2- All files containing unification hints broke.
Again, there are universe constraints on the header that we only learn
after we elaborate the body.

3- Many `CoeSort` and `CoeFun` examples broke.
Example:
```
structure Group :=
  (carrier : Type u) (mul : carrier → carrier → carrier) (one : carrier)

instance GroupToType : CoeSort Group (Type u) :=
  CoeSort.mk (fun g => g.carrier)
```
We would have to write
```
instance GroupToType : CoeSort Group.{u} (Type u) :=
  CoeSort.mk (fun g => g.carrier)
```
We would have to provide universe level parameters manually in this
kind of instance. I think it would be too annoying.
2021-02-25 16:53:58 -08:00
Leonardo de Moura
09de37e8e5 chore: improve error message 2021-02-05 12:26:39 -08:00
Leonardo de Moura
4fc2aead45 fix: missing checkAssignment at assignToConstFun
Fixes #297
2021-01-26 17:33:33 -08:00
Leonardo de Moura
9d0edab6c3 chore: add issue 297 examples
The stack overflow reported on this issue has already been fixed.

closes #297
2021-01-26 08:07:41 -08:00