Skip to content

[Feature Request] Cast bool as u64 in Move #19126

Description

@alinush

🚀 Feature Request

Motivation

The following reasonable code:

auditor.epoch += should_increment as u64;

...does not compile:

error: expected `integer` but found a value of type `bool`
    ┌─ /Users/alinush/repos/aptos-core/aptos-move/framework/aptos-experimental/sources/confidential_asset/confidential_asset.move:733:26
    │
733 │         auditor.epoch += (should_increment as u64);
    │                          ^^^^^^^^^^^^^^^^^^^^^^^^^

Pitch

Describe the solution you'd like
Allow casting bool to u64 via the as keyword.

Describe alternatives you've considered
None.

Are you willing to open a pull request? (See CONTRIBUTING)
Maybe.

Additional context

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    Status
    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions