proc staticLengthCheck[A, B: static[int]](a: array[A, int], b: array[B, int]): array[4, int] =
static:
assert A + B == 4
discard # do stuff here
discard staticLengthCheck([1], [1, 2, 3]) # ok
discard staticLengthCheck([1, 2], [1, 2, 3]) # compile time assertion error
Feel free to use {.error.} insert of assert if you want to provide a customized error message.