error for NimNode index kind (#12154)
This commit is contained in:
parent
18135cc194
commit
e5139b0662
4 changed files with 34 additions and 6 deletions
8
tests/errmsgs/tnnodeadd.nim
Normal file
8
tests/errmsgs/tnnodeadd.nim
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
discard """
|
||||
errormsg: "cannot add to node kind: nnkInt8Lit"
|
||||
line: 7
|
||||
"""
|
||||
import macros
|
||||
macro t(x: untyped): untyped =
|
||||
x.add(newEmptyNode())
|
||||
t(38'i8)
|
||||
8
tests/errmsgs/tnnodeindex.nim
Normal file
8
tests/errmsgs/tnnodeindex.nim
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
discard """
|
||||
errormsg: "index 5 not in 0 .. 2"
|
||||
line: 7
|
||||
"""
|
||||
import macros
|
||||
macro t(x: untyped): untyped =
|
||||
result = x[5]
|
||||
t([1, 2, 3])
|
||||
8
tests/errmsgs/tnnodeindexkind.nim
Normal file
8
tests/errmsgs/tnnodeindexkind.nim
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
discard """
|
||||
errormsg: "cannot set child of node kind: nnkStrLit"
|
||||
line: 7
|
||||
"""
|
||||
import macros
|
||||
macro t(x: untyped): untyped =
|
||||
x[0] = newEmptyNode()
|
||||
t("abc")
|
||||
Loading…
Add table
Add a link
Reference in a new issue