-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat: support ()
type in typegen
#2122
Conversation
Co-authored-by: Peter Smith <peter@blueoceancomputing.co.uk>
Oof. It's a tough one - I'm not sure I can handle it. 😅 |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
…ty-sway-type-in-typegen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These feel ok:
contract.functions.empty().call();
contract.functions.value_then_empty(35).call();
These do not:
contract.functions.empty_then_value(35).call();
contract.functions.value_then_empty_then_value(35, 35).call();
I believe the expected usage would be somewhat similar to the following:
contract.functions.empty_then_value(null, 35).call();
contract.functions.value_then_empty_then_value(35, null, 35).call();
EDIT: If empty types are always ignored, should they exist in Sway and compile successfully? Do you know their purpose?
@arboleya I don't know the purpose of the empty types. I agree with you that the expected behavior should be the one you mentioned for all cases. I didn't implement it like that because it required changes to the runtime behavior of the ABI coder, because currently the abi-coder also removes the empty types and fails if you provide it a value like in your proposal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please create a detailed follow-up issue with the adjustments you mentioned on the ABI Coder.
Using our tests to dogfood Typegen was a nice touch! 👏 🚀
I hope this is also beneficial for browser testing.
Co-authored-by: Anderson Arboleya <anderson@arboleya.me>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks wonderful 🚢
Coverage Report:
Changed Files:
|
While implementing #2070 I came across an issue with
call-test-contract
'sfoobar
function that takes in an empty()
type. Typegen couldn't handle it and was throwing so I implemented the logic for supporting()
types.Now, empty inputs are ignored in
typegen
. This corresponds to how we're encoding empty arguments during runtime - we ignore them. I added tests to verify this runtime behavior as well.