-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
interp: fix array declaration with a typed constant size
In parsing array type declaration, The type check of array size was restricted to `int`. Broaden the test to accept any valid integer kind. Fixes #1175.
- Loading branch information
Showing
2 changed files
with
20 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package main | ||
|
||
type Level int8 | ||
|
||
const ( | ||
a Level = -1 | ||
b Level = 5 | ||
d = b - a + 1 | ||
) | ||
|
||
type counters [d]int | ||
|
||
func main() { | ||
println(len(counters{})) | ||
} | ||
|
||
// Output: | ||
// 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters