I have the macro that produces const arrays, unfortunately when array comes out of macro as empty, it doesn't compile:
const required_fields: array[0, tuple[f1: int, f2: string]] = []
Compiler complains:
Error: type mismatch: got (array[0..-1, empty]) but expected 'array[0..-1, tuple[f1: string, f2: stri
ng]]'
Any quick hack I can use to make it work?I have shown the output of the macro. If array was written manually, I could simply remove the empty array as it is of no use. But this one is autogenerated.
Also const can't be left without initializer. It doesn't compile, which make sense:
const required_fields: array[0, tuple[f1: int, f2: string]]
Seems like a bug to me but it can be hacked quite easily:
const required_fields: array[0, tuple[f1: int, f2: string]] =
static(var a: array[0, tuple[f1: int, f2: string]]; a)