{"action":"opened","issue":{"url":"https://api.github.com/repos/nim-lang/Nim/issues/3670","labels_url":"https://api.github.com/repos/nim-lang/Nim/issues/3670/labels{/name}","comments_url":"https://api.github.com/repos/nim-lang/Nim/issues/3670/comments","events_url":"https://api.github.com/repos/nim-lang/Nim/issues/3670/events","html_url":"https://github.com/nim-lang/Nim/issues/3670","id":123995148,"number":3670,"title":"Error upon conditional declaration inside a template","user":{"login":"yglukhov","id":6962409,"avatar_url":"https://avatars.githubusercontent.com/u/6962409?v=3","gravatar_id":"","url":"https://api.github.com/users/yglukhov","html_url":"https://github.com/yglukhov","followers_url":"https://api.github.com/users/yglukhov/followers","following_url":"https://api.github.com/users/yglukhov/following{/other_user}","gists_url":"https://api.github.com/users/yglukhov/gists{/gist_id}","starred_url":"https://api.github.com/users/yglukhov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yglukhov/subscriptions","organizations_url":"https://api.github.com/users/yglukhov/orgs","repos_url":"https://api.github.com/users/yglukhov/repos","events_url":"https://api.github.com/users/yglukhov/events{/privacy}","received_events_url":"https://api.github.com/users/yglukhov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-27T20:25:56Z","updated_at":"2015-12-27T20:25:56Z","closed_at":null,"body":"This looks related to #2670. Consider the following example:\r\n```nim\r\ntemplate someTempl(someConst: bool) =\r\n  when someConst:\r\n    var a : int\r\n  if true:\r\n    when not someConst:\r\n      var a : int\r\n    a = 5\r\n\r\nsomeTempl(true)\r\n```\r\n```\r\ntest.nim(9, 10) template/generic instantiation from here\r\ntest.nim(7, 5) Error: expression 'a' has no type (or is ambiguous)\r\n```"}}