If you try to initialize a param with another param the type-checker does not complain.
But, the generated code cannot be compiled by a C-compiler
To Reproduce
The following program in file typing.blc
param x: int32 = 42
param y: int32 = x * 2
@[EntryPoint]
activity Test() returns int32
await true
return y
end
compiles without errors
blechc --app typing.blc
A C compiler cannot compile the generated code
cd blech
clang -Iinclude blech.c
and shows the following error message
In file included from blech.c:21:
./typing.c:42:54: error: initializer element is not a compile-time constant
static blc_int32 blc_01typing01_y = blc_01typing01_x * 2;
~~~~~~~~~~~~~~~~~^~~
1 error generated.
Expected behaviour
Either a typing error in the Blech compiler,
Or even better - but much more effort and a big change - a different code generation for parameter initialization, maybe as a function, called from the initialiser.
If you try to initialize a
param
with anotherparam
the type-checker does not complain. But, the generated code cannot be compiled by a C-compilerTo Reproduce The following program in file
typing.blc
compiles without errors
A C compiler cannot compile the generated code
and shows the following error message
Expected behaviour Either a typing error in the Blech compiler, Or even better - but much more effort and a big change - a different code generation for parameter initialization, maybe as a function, called from the initialiser.