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

{.booldefine.} are not considered constants in type sections #12880

Closed
mratsim opened this issue Dec 11, 2019 · 2 comments · Fixed by #13964
Closed

{.booldefine.} are not considered constants in type sections #12880

mratsim opened this issue Dec 11, 2019 · 2 comments · Fixed by #13964
Labels

Comments

@mratsim
Copy link
Collaborator

mratsim commented Dec 11, 2019

Test case:

const True {.booldefine.} = true

type
  Foo = object
    a: int
    when True:
      b: int

Error:
Error: constant expression expected

Workaround with static so tagging low priority.

const True {.booldefine.} = true

type
  Foo = object
    a: int
    when static(True):
      b: int
@mratsim mratsim added Low Priority VM see also `const` label Type Sections labels Dec 11, 2019
@timotheecour
Copy link
Member

timotheecour commented Dec 23, 2019

wondering if same root cause as #12929

EDIT: no because issue still there despite #12880 being fixed

@disruptek
Copy link
Contributor

Maybe this should be backported?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants