Assigning template to var/let/const gives a proper error (#12851)
* Assigning template to var/let/const gives a proper error * Fix style
This commit is contained in:
parent
a3d45d0c1b
commit
7ebb2baa6c
4 changed files with 24 additions and 7 deletions
13
tests/errmsgs/t12844.nim
Normal file
13
tests/errmsgs/t12844.nim
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
discard """
|
||||
cmd: "nim check $file"
|
||||
errormsg: "cannot assign template 'z' to 'y'. Did you mean to call the template with '()'?"
|
||||
nimout: '''
|
||||
t12844.nim(11, 11) Error: cannot assign template 'z' to 'x'. Did you mean to call the template with '()'?
|
||||
t12844.nim(12, 9) Error: cannot assign template 'z' to 'y'. Did you mean to call the template with '()'?'''
|
||||
"""
|
||||
|
||||
template z*(args: varargs[string, `$`]) =
|
||||
discard
|
||||
const x = z
|
||||
var y = z
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue