Closed dijkstracula closed 1 year ago
➜ irving git:(main) cargo run -q programs/200_chainrep.ivy extract ivy
Typechecking error: Unbound variable end at:
|
1 | #lang ivy1.8
2 |
3 | #
4 | # Use a strategy called "chain replication" to maintain a consistent
...
90 | ensure forall P1:pid,P2:pid, I. msg_count = 0 ->
91 | host(P1).contents.end = host(P2).contents.end &
| ^^ here
|
➜ irving git:(main)
This is good enough for the moment. It's far from complete but we can fault in spans for more parts of the AST as we come across them.
One thing that I would like to do is contemplate what we'd need in order to have more than one annotation for an error: for instance, for a "assign the wrong sort to a value" error, it'd be nice to point back to the original definition in the source. Probably just minor refactoring, and not important, but would be Pleasing.
Currently parse errors are good, thanks to pest:
But any semantic error like a typechecking error is terrible.
This of course sucks. We don't have source file/line number info and certainly nothing like annotated snippets. The main problem is that our AST has no way of associating a node / subtree with a parser span. This should change.
Things to do:
[x] Accumulate an Rc in is not Sync and anyhow requires that it is
[] Annotate leaf nodes / terminals of the AST with a parser span
[] merge spans up the AST for non-terminals.
pest_consume::Node
, which is our current program source; [] Modify TypeError to not hold any AST nodes, since Rc