-
Notifications
You must be signed in to change notification settings - Fork 131
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
Refined ABI type-check on assignment #540
Conversation
e9135d5
to
99c5c8e
Compare
99c5c8e
to
116a88f
Compare
a535375
to
b7354f9
Compare
* Add illustrative testing DSL for type_spec_is_assignable_to * Use NamedTuple to construct `dataclass`-alike class * Boundary testcase group guarding Co-authored-by: Hang Su <[email protected]>
c23f1ba
to
4b07317
Compare
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.
Mostly looks good, but I have concerns about NamedTuples
I have one final reservation. Right now class Point(abi.NamedTuple):
x: abi.Field[abi.Uint64]
y: abi.Field[abi.Uint64]
class AccountRecord(abi.NamedTuple):
algoBalance: abi.Field[abi.Uint64]
assetBalance: abi.Field[abi.Uint64]
p = Point()
ar = AccountRecord()
assert p.type_spec() == ar.type_spec()
assert abi.type_spec_is_assignable_to(p.type_spec(), ar.type_spec()) I'd argue having the equals method return true between different |
oh boy 🤦 just pushed to save the |
Co-authored-by: Michael Diamant <[email protected]>
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.
@ahangsu Looks correct - thanks for addressing the added feedback.
Consider these approval notes:
- I optionally suggest holding for a 2nd approval.
- Once this PR is merged, I expect Relax the type checking on arguments to subroutine #531 will be updated to leverage
type_spec_is_assignable_to
prior to issuing a PyTeal release.
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.
This looks good! I only left a small comment about calling out some of the recent changes in the changelog
I just dump everything to master, and get #531 merged ASAP. |
After a few short discussions with @jasonpaulos on 2022/09/21-2022/09/22, we decided to introduce another typecheck mechanism on variable assignment for ABI values.
Such mechanism would benefit following issues and PRs: #530, #531, #537