Skip to content
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

Bind type(...).min and type(...).max to the operand type #1158

Open
ggiraldez opened this issue Nov 25, 2024 · 0 comments
Open

Bind type(...).min and type(...).max to the operand type #1158

ggiraldez opened this issue Nov 25, 2024 · 0 comments
Assignees

Comments

@ggiraldez
Copy link
Contributor

The type() expressions in Solidity return some information about the type argument. This information is dependent on what the argument is (see the documentation). The binding rules already bind to different built-in types depending on the argument, using special case rules and @type guarded paths in the stack graph (see the rules here).

Both for integer types and enums though, the .min and .max fields should bind to the argument type, but they are currently fixed in the built-in definitions as uint. This would be ideally expressed through generic types, but since Solidity does not support them, it's not possible to encode the desired behaviour in the built-ins. For cases like this, we need to encode the return type in the binding rules themselves. For example, binding of array's push() which returns a reference to the pushed element is implemented here.

To avoid later conflicts, this should be implemented on top of #1149.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ⏳ Todo
Development

No branches or pull requests

2 participants