fixes #11872; include now gives a proper error message for all invalid infix operators (#11965)

This commit is contained in:
nc-x
2019-08-17 23:15:47 +05:30
committed by Andreas Rumpf
parent db9e27dffd
commit b68380f09b
2 changed files with 8 additions and 0 deletions

View File

@@ -2035,6 +2035,8 @@ proc evalInclude(c: PContext, n: PNode): PNode =
for i in 0 ..< sonsLen(n):
var imp: PNode
let it = n.sons[i]
if it.kind == nkInfix and it.len == 3 and it[0].ident.s != "/":
localError(c.config, it.info, "Cannot use '" & it[0].ident.s & "' in 'include'.")
if it.kind == nkInfix and it.len == 3 and it[2].kind == nkBracket:
let sep = it[0]
let dir = it[1]

View File

@@ -0,0 +1,6 @@
discard """
errormsg: "Cannot use 'as' in 'include'."
line: 6
"""
include foobar as foo