semcheck negative array length (#7518)

This commit is contained in:
Oscar Nihlgård 2018-04-06 17:05:28 +02:00 • committed by Andreas Rumpf
commit 651c0e45da
2 changed files with 7 additions and 0 deletions

View file

@ -46,3 +46,7 @@ let arr3: array[0, string] = []
doAssert(arr1.len == 0)
doAssert(arr2.len == 0)
doAssert(arr3.len == 0)
# Negative array length is not allowed (#6852)
doAssert(not compiles(block:
var arr: array[-1, int]))