You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from "./utils/matrix" import MATRIX
const u32 SIZE = 4
def main(field scalar):
field[SIZE][SIZE] result = [[0; SIZE]; SIZE]
for u32 i in 0..SIZE do
for u32 j in 0..SIZE do
result[i][j] = MATRIX[i][j] * scalar
endfor
endfor
assert(result == [[0; SIZE]; SIZE])
return
$ zokrates compile -i bug/main.zok
Compiling bug/main.zok
Compilation failed:
bug/main.zok:
Expression of type`field[4][4]` cannot be assigned to constant `bug/main.zok/MATRIX` of type`field[bug/./utils/matrix.zok/SIZE][bug/./utils/matrix.zok/SIZE]`
However, replacing const field[SIZE][SIZE] MATRIX with const field[4][4] MATRIX in bug/utils/matrix.zok solves the issue though.
The text was updated successfully, but these errors were encountered:
sshravan
changed the title
Declaring and assigning const array with const array size
Declaring and assigning const array with const size
Nov 7, 2021
Hey @sshravan, thanks for the report. This is definitely a bug.
devnote: I've reduced the issue to:
// utils/mod2.zok
// surprisingly, it works when moving this module one folder up (./mod2)
const field A = 1
const field B = A + 1
// mod1.zok
from "./utils/mod2" import B
def main():
return
Description
Const value not realized during assignment.
Environment
Steps to Reproduce
bug/utils/matrix.zok
bug/main.zok
However, replacing
const field[SIZE][SIZE] MATRIX
withconst field[4][4] MATRIX
inbug/utils/matrix.zok
solves the issue though.The text was updated successfully, but these errors were encountered: