New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A bizzare static int related error #9114
Comments
Not too sure how to solve that but the relevant part of the error message is this:
|
Is the |
No. But, sure, I shouldn't use it in the example in the first place. This returns the same error: type Obj[N: static int] = object
func arr(N: static int, fn: proc(_: 0..N): void): Obj[N] =
for i in (0 .. N): fn i
func map[N](a: Obj[N], fn: proc()): Obj[N] =
arr(N, proc(i: 0..N) = fn())
static:
# discard Obj[2]().map(proc() = discard)
# discard Obj[3]().map(proc() = discard)
discard |
type Obj[N: static int] = object
func arr[N: static int](fn: proc(_: 0..N): void): Obj[N] =
for i in (0 .. N): fn i
func map[N](a: Obj[N], fn: proc()): Obj[N] =
arr[N](proc(i: 0..N) = fn())
static:
discard Obj[2]().map(proc() = discard)
discard Obj[3]().map(proc() = discard) Using a |
@dawkot is the question solved? |
@krux02 Sure, but at least the error message should be more clear. |
The code compiles now on
|
When either of the commented lines is uncommented the code compiles, but if both are uncommented an error is returned.
error message:
The text was updated successfully, but these errors were encountered: