[Chore] Attach source code location to interpreter error messages
Description
Problem: We have the similar mechanism for typechecker errors, however, it also makes sense to report a precise source position for FAILWITH and other instructions which can fail in the interpreter. We already have the source location information in the AST during interpretation. All that's left is threading that through and attaching it to MichelsonFailed errors when needed.
Solution:
- add 'InstrCallStack' field to 'ContractEnv' (for the purpose of threading the source location around through Reader)
- add 'MichelsonFailureWithStack', a product of 'MichelsonFailed' and 'InstrCallStack'; use it as interpreter error instead of plain 'MichelsonFailed'
- add 'Buildable' instances for 'InstrCallStack' and 'MichelsonFailureWithStack'
- make the necessary changes to keep the compiler happy
- add a test
Related issue(s)
Resolves TM-155
✅ Checklist for your Merge Request
Related changes (conditional)
-
Tests (see short guidelines)
-
If I added new functionality, I added tests covering it. -
If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
-
-
Documentation
Stylistic guide (mandatory)
-
My commits comply with the following policy. -
My code complies with the style guide.
Edited by Nikolay Yakimov