[TM-267]: Fix bad error messages in let-block
Description
Problem: Bad error message in let-block
For example, if we have this in let-block:
let {
type Store = (BigMap Address Nat, Nat);
test :: '[option int] -> '[int]
= { IF_SOME { nop } { PUSH int 3 }; };
# ^^^
# Adding `nop` here will cause an error
};
Expected error message:
morley: ../../contracts/FA1/custom.mtz:10:16:
|
10 | = { IF_SOME {nop} { PUSH int 3 }; };
| ^
unexpected 'n'
Actual error message:
morley: ../../contracts/FA1/custom.mtz:9:3:
|
9 | test :: '[option int] -> '[int]
| ^
unexpected 't'
expecting '}'
This is due to backtracing issues.
Solution: Fixed by narrowing down the try
backtracing.
Related issue(s)
Resolves TM-267
✅ 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.