Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Cannot create a type referencing a local constant #260

@alaviss

Description

@alaviss
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions