You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
templatetest*(name: string, body) =block: body
templatetest*(name: string, group: string, body) =block: body
test"a1":
let a =1test"a2":
let a =1
Current Output
Hint: used config file '/playground/nim/config/nim.cfg' [Conf]
Hint: used config file '/playground/nim/config/config.nims' [Conf]
....
/usercode/in.nim(8, 7) Hint: 'a' is declared but not used [XDeclaredButNotUsed]
/usercode/in.nim(11, 7) Error: redefinition of 'a'; previous declaration here: /usercode/in.nim(8, 7)
The text was updated successfully, but these errors were encountered:
The body argument to the first template gets typechecked as there is an overload on it where there is a typed argument in the same place. I think your best option for now is to remove the : string annotation on group. To fix this Nim needs to alter its overload semantics in a case like this where it's obvious the arities don't match, but that might be unpredictable.
Late edit: This means this is another case of #14827
The code below won't compile, because of redeclaration of the
let a
variable.But if the second test template commented out it would work.
Example
playground
Current Output
The text was updated successfully, but these errors were encountered: