Commit graph

9 commits

Author SHA1 Message Date
Kyle Miller
3acd77a154
fix: make elabTermEnsuringType respect errToSorry when there is a type mismatch (#3633)
Floris van Doorn [reported on
Zulip](https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/have.20tactic.20error.20recovery/near/425283053)
that it is confusing that the `have : T := e` tactic completely fails if
the body `e` is not of type `T`. This is in contrast to `have : T := by
exact e`, which does not completely fail when `e` is not of type `T`.

This ends up being caused by `elabTermEnsuringType` throwing an error
when it fails to insert a coercion. Now, it detects this case, and it
checks the `errToSorry` flag to decide whether to throw the error or to
log the error and insert a `sorry`.

This is justified by `elabTermEnsuringType` being a frontend to
`elabTerm`, which inserts `sorry` on error.

An alternative would be to make `ensureType` respect `errToSorry`, but
there exists code that expects being able to catch when `ensureType`
fails. Making such code manipulate `errToSorry` seems error prone, and
this function is not a main entry point to the term elaborator, unlike
`elabTermEnsuringType`.
2024-03-09 15:30:47 +00:00
Leonardo de Moura
fdce7a99e1 feat: structure diamonds basic support
See TODO in the new comments.
2021-08-09 19:01:08 -07:00
Leonardo de Moura
635bc78d72 feat: use structure extension to implement Structure.lean 2021-08-02 18:03:20 -07:00
Leonardo de Moura
db9e390b4d chore: remove new_frontend from tests 2020-10-25 09:16:38 -07:00
Leonardo de Moura
c58252ad74 chore: move more tests to new frontend 2020-09-13 16:13:20 -07:00
Leonardo de Moura
db53d0aa7e fix: validate visibility modifiers 2020-07-23 15:13:55 -07:00
Leonardo de Moura
801acd3e62 feat: elaborate fields 2020-07-21 16:57:36 -07:00
Leonardo de Moura
19fc369875 feat: throw error at field names starting with '_' 2020-07-21 16:57:36 -07:00
Leonardo de Moura
1267b4908f feat: elaborate parents and subfields 2020-07-20 16:14:36 -07:00