Closes #13253
This commit is contained in:
parent
03b0374e5c
commit
695a537c05
1 changed files with 31 additions and 0 deletions
|
|
@ -29,6 +29,12 @@ array[0 .. 100, int]
|
||||||
10
|
10
|
||||||
test
|
test
|
||||||
0o377'i8
|
0o377'i8
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
foo1
|
||||||
|
foo2
|
||||||
|
foo3
|
||||||
'''
|
'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -258,3 +264,28 @@ macro foobar() =
|
||||||
echo loopVars
|
echo loopVars
|
||||||
|
|
||||||
foobar()
|
foobar()
|
||||||
|
|
||||||
|
|
||||||
|
# bug #13253
|
||||||
|
import macros
|
||||||
|
|
||||||
|
type
|
||||||
|
FooBar = object
|
||||||
|
a: seq[int]
|
||||||
|
|
||||||
|
macro genFoobar(a: static FooBar): untyped =
|
||||||
|
result = newStmtList()
|
||||||
|
for b in a.a:
|
||||||
|
result.add(newCall(bindSym"echo", newLit b))
|
||||||
|
|
||||||
|
proc foobar(a: static FooBar) =
|
||||||
|
genFoobar(a) # removing this make it work
|
||||||
|
for b in a.a:
|
||||||
|
echo "foo" & $b
|
||||||
|
|
||||||
|
proc main() =
|
||||||
|
const a: seq[int] = @[1, 2,3]
|
||||||
|
# Error: type mismatch: got <array[0..2, int]> but expected 'seq[int]'
|
||||||
|
const fb = Foobar(a: a)
|
||||||
|
foobar(fb)
|
||||||
|
main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue