We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When defining a function, the compiler allows reusing the same name for different args, while interpreting the clarity code raises an error.
Failing test:
#[test] fn reuse_arg_name() { crosscheck_compare_only("(define-private (foo (a int) (a int)) a) (foo 1 2)") }
results in:
assertion `left == right` failed: Compiled and interpreted results diverge! (define-private (foo (a int) (a int)) a) (foo 1 2) compiled: Ok(Some(Int(2))) interpreted: Err(Unchecked(NameAlreadyUsed("a"))) left: Ok(Some(Int(2))) right: Err(Unchecked(NameAlreadyUsed("a")))
The text was updated successfully, but these errors were encountered:
Adding a note here that the interpreter catches this at runtime, not at deploy time, so for example if you just have:
(define-public (foo (a int) (a int)) (ok a))
This will deploy fine, but only when you call it will it report a runtime error:
error: Runtime Error: Runtime error while interpreting ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.contract-3: Unchecked(NameAlreadyUsed("a"))
Sorry, something went wrong.
Done in #510
matteojug
No branches or pull requests
When defining a function, the compiler allows reusing the same name for different args, while interpreting the clarity code raises an error.
Failing test:
results in:
The text was updated successfully, but these errors were encountered: