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

Mod operation fails on integer literals without type annotation #1332

Open
gwdjkspnado opened this issue Aug 1, 2023 · 0 comments
Open

Mod operation fails on integer literals without type annotation #1332

gwdjkspnado opened this issue Aug 1, 2023 · 0 comments
Assignees

Comments

@gwdjkspnado
Copy link

Description

The % operator cannot be applied to integer constants without explicit type annotation.

Environment

  • Zokrates Compiler version: 0.8.7
  • Operating system: Ubuntu 22.04.2 LTS

Steps to Reproduce

Minimal code to reproduce the issue

def main() {
    u32 a = 2 % 1;
}

Compile with zokrates compile -i mod.zok, you would get the following error:

Compiling mod.zok

Compilation failed:

mod.zok:2:13
        Cannot apply `%` to {integer}, {integer}

If you explicitly specify the types of the integer constants, the error would be gone:

def main() {
    u32 a = 2u32 % 1u32;
}
@dark64 dark64 self-assigned this Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants