[clarity] Calling non-existent contract within `define-read-only` yields wrong error
Describe the bug
If you make a contract-call? to an undefined contract within a define-read-only block, the error is expecting read-only statements, detected a writing operation rather than indicating that the contract being called does not exist.
Steps To Reproduce Create a contract with the following:
(define-read-only (call-ok-true)
(ok (contract-call? does_not_exist ok-true)))
Note the error expecting read-only statements, detected a writing operation, rather than something like contract does_not_exist is not defined
Expected behavior
To receive a contract does_not_exist is not defined error
Environment (please complete the following information):
- Currently, clarinet is built using the clarity package from this commit: https://github.com/stacks-network/stacks-core/commit/45843513a
This is just a side effect of the fact that the read-only checker runs before the type-checker. I don't think this is necessarily a problem.