mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 09:24:36 +00:00
* Fixes #10514
(cherry picked from commit f6f789bb4d)
* Add comment
* Add changelog entry
43 lines
546 B
Nim
43 lines
546 B
Nim
|
|
discard """
|
|
nimout: "##"
|
|
"""
|
|
|
|
import macros
|
|
|
|
proc testProc: string {.compileTime.} =
|
|
result = ""
|
|
result = result & ""
|
|
|
|
when true:
|
|
macro test(n: untyped): untyped =
|
|
result = newNimNode(nnkStmtList)
|
|
echo "#", testProc(), "#"
|
|
test:
|
|
"hi"
|
|
|
|
const
|
|
x = testProc()
|
|
|
|
doAssert x == ""
|
|
|
|
# bug #1310
|
|
static:
|
|
var i, j: set[int8] = {}
|
|
var k = i + j
|
|
|
|
type
|
|
Obj = object
|
|
x: int
|
|
|
|
converter toObj(x: int): Obj = Obj(x: x)
|
|
|
|
# bug #10514
|
|
block:
|
|
const
|
|
b: Obj = 42
|
|
bar = [b]
|
|
|
|
let i_runtime = 0
|
|
doAssert bar[i_runtime] == b
|