-
Notifications
You must be signed in to change notification settings - Fork 671
New issue
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
Inconsistent behavior when using a trait parameter #1621
Comments
It does not look like an error.
The call is |
Yeah -- I think we should be able to handle the case, because this would be allowed if it were called via contract-call, e.g.,
And then in another contract:
Would work -- the type checker will allow supplying a literal principal instead of a trait reference. The only reason this doesn't work for calling functions directly is that the |
Addressed with #1679 |
Describe the bug
Calling a contract with a Trait parameter works when done dynamically via the api, but not statically when written directly in the contract.
Steps To Reproduce
Clone https://github.com/psq/ClarityTraitExample, run
npm install
, then runnpm test
.The test should pass when the contract gets given the
<trait>
at runtime.Now, uncomment line 7 of dispatcher.clar (https://github.com/psq/ClarityTraitExample/blob/master/contracts/dispatcher.clar#L7)
and run the test again: you get this output:
which seems to mean that it was expecting a
TraitReferenceType
but was given aPrincipal
. That's the same value that was passed and worked when calling the contract dynamically.Expected behavior
Both should be equivalent, and the static version should not report an error of a Principal not being compatible with a Trait.
Environment (please complete the following information):
Additional context
Everything to reproduce should be at https://github.com/psq/ClarityTraitExample, but I can provided additional info if needed.
The text was updated successfully, but these errors were encountered: