Skip to content
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

Macro + Static in object field: undeclared identifier N if proc result #7547

Closed
mratsim opened this issue Apr 8, 2018 · 0 comments · Fixed by #24028
Closed

Macro + Static in object field: undeclared identifier N if proc result #7547

mratsim opened this issue Apr 8, 2018 · 0 comments · Fixed by #24028

Comments

@mratsim
Copy link
Collaborator

mratsim commented Apr 8, 2018

Another macro + static issue.

Test case:

import macros

macro foo(N: static[int]): untyped =
  result = getType(int)

type
  Foo[N: static[int]] = foo(N)

  ContainsFoo[N: static[int]] = object
    Ffoo: Foo[N]

proc initFoo(N: static[int]): Foo[N] =
  discard

proc initContainsFoo(size: static[int]): ContainsFoo[size] =
  discard

###########################################

var a: Foo[10] # Works
echo a

let b = initFoo(10) # Works
echo b

let c = ContainsFoo[5]() # Works
echo c

##########################################

let z = initContainsFoo(5) # Error: undeclared identifier: 'N'
echo z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants