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

Cannot create a type referencing a local constant #260

Open
alaviss opened this issue Nov 12, 2021 · 0 comments
Open

Cannot create a type referencing a local constant #260

alaviss opened this issue Nov 12, 2021 · 0 comments
Labels
bug Something isn't working nim compiler "feature" fault lies elsewhere

Comments

@alaviss
Copy link
Contributor

alaviss commented Nov 12, 2021

import cps

proc foo() {.cps: Continuation.} =
  const X = 10
  var x: array[X, int]

got:

test.nim(3, 14) template/generic instantiation of `cps` from here
test.nim(5, 16) Error: undeclared identifier: 'X'

The problem is that Nim did not inline X into array[X, int], which is carried over to the environment definition, where X doesn't exist.

@alaviss alaviss added bug Something isn't working nim compiler "feature" fault lies elsewhere labels Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working nim compiler "feature" fault lies elsewhere
Projects
None yet
Development

No branches or pull requests

1 participant