Files
Nim/tests/template/ttempl2.nim
Arne Döring 5b27b263fd Remove immediate pragma (#11308)
* remove immediate from tests
* remove immediate from the compiler
2019-05-29 22:21:51 +02:00

19 lines
403 B
Nim

discard """
errormsg: "undeclared identifier: \'b\'"
file: "ttempl2.nim"
line: 18
"""
template declareInScope(x: untyped, t: typeDesc): untyped =
var x: t
template declareInNewScope(x: untyped, t: typeDesc): untyped =
# open a new scope:
block:
var x: t
declareInScope(a, int)
a = 42 # works, `a` is known here
declareInNewScope(b, int)
b = 42 #ERROR_MSG undeclared identifier: 'b'