Skip to content

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

@ggiraldez

Description

@ggiraldez

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions