Commit graph

13 commits

Author SHA1 Message Date
Leonardo de Moura
91aaab9e0d fix: error message location 2020-10-07 17:43:23 -07:00
Leonardo de Moura
5b76155318 feat: new return semantics
`return e` is not equivalent to `pure e` anymore.
Now, `return e` means "return value `e` as the result of the root `do` block".
2020-10-07 14:07:58 -07:00
Leonardo de Moura
e70dd03340 chore: remove forInMap 2020-10-07 10:01:04 -07:00
Leonardo de Moura
cda4de474b fix: weird error message in do notation
cc @Kha
2020-10-06 15:12:55 -07:00
Leonardo de Moura
db1b110f7e fix: use let* to avoid bad error messages in do notation
cc @Kha
2020-10-06 15:01:05 -07:00
Leonardo de Moura
82dad3c86f feat: add Code.returnAction 2020-10-06 13:19:55 -07:00
Leonardo de Moura
5110b1212d test: do notation error messages 2020-10-06 11:35:44 -07:00
Leonardo de Moura
13591e59d5 chore: improve regular 'for' error message 2020-10-06 11:30:14 -07:00
Leonardo de Moura
760b658d19 chore: suppress extraMsg in type mismatch errors 2020-10-06 10:58:50 -07:00
Leonardo de Moura
7f5b454382 chore: improve for type mismatch error message 2020-10-06 10:50:03 -07:00
Leonardo de Moura
5cabc917f5 chore: improve error message 2020-10-06 10:45:12 -07:00
Leonardo de Moura
3a426d96e7 feat: custom error message header at elabTermEnsuringType
This commit also improves `ensureTypeOf!` primitive.
2020-10-06 09:27:13 -07:00
Leonardo de Moura
54e10776d4 feat: improve error messages for do notation
@Kha we are getting better error message, but we need to figure out a
way to suppress error messages that come from the "plumbing".
For example, in the following example.
```
def f4 (b : Bool) (n : Nat) (v : Vector Nat n) : Vector Nat (n+1) := do
if b then
  v := Vector.cons 1 v
Vector.cons 1 v
```
We get the nice "invalid reassignment" error at `v := ...`, but
we also get the nasty
```
error: application type mismatch
  jp✝ v
argument
  v
has type
  Vector Nat (n + 1)
but is expected to have type
  Vector Nat n
failed to synthesize instance
  CoeT (Vector Nat (n + 1)) v (Vector Nat n)
```
Where `jp✝` is a joinpoint created by the do-notation macro expander.
I thought about using `withoutErrToSorry` when elaborating the expanded
`do` term.
We may also try to add more helper hints such as `ensureTypeOf!` and
use them around "plumbing" code (e.g., "joinpoint goto"s)
2020-10-05 16:33:59 -07:00