array type syntax implies comptime

This commit is contained in:
Andrew Kelley
2018-11-09 19:26:54 -05:00
parent 8e69a18d8c
commit ef5d7ce463
3 changed files with 14 additions and 5 deletions

View File

@@ -162,3 +162,12 @@ test "comptime evalutating function that takes array by value" {
_ = comptime testArrayByValAtComptime(arr);
_ = comptime testArrayByValAtComptime(arr);
}
test "implicit comptime in array type size" {
var arr: [plusOne(10)]bool = undefined;
assert(arr.len == 11);
}
fn plusOne(x: u32) u32 {
return x + 1;
}