Skip to content

Error upon conditional declaration inside a template #3670

@yglukhov

Description

@yglukhov

This looks related to #2670. Consider the following example:

template someTempl(someConst: bool) =
  when someConst:
    var a : int
  if true:
    when not someConst:
      var a : int
    a = 5

someTempl(true)
test.nim(9, 10) template/generic instantiation from here
test.nim(7, 5) Error: expression 'a' has no type (or is ambiguous)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions