fixes #913
This commit is contained in:
parent
034af8354d
commit
cf7e83ecc5
3 changed files with 21 additions and 0 deletions
|
|
@ -20,3 +20,4 @@ import:testability
|
|||
define:useStdoutAsStdmsg
|
||||
|
||||
cs:partial
|
||||
#define:useNodeIds
|
||||
|
|
|
|||
|
|
@ -668,6 +668,8 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation =
|
|||
result = isNone
|
||||
else: discard
|
||||
of tyOpenArray, tyVarargs:
|
||||
# varargs[expr] is special
|
||||
if f.kind == tyVarargs and f.sons[0].kind == tyExpr: return
|
||||
case a.kind
|
||||
of tyOpenArray, tyVarargs:
|
||||
result = typeRel(c, base(f), base(a))
|
||||
|
|
|
|||
18
tests/typerel/tvarargsexpr.nim
Normal file
18
tests/typerel/tvarargsexpr.nim
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
discard """
|
||||
output: '''success'''
|
||||
"""
|
||||
|
||||
#bug #913
|
||||
|
||||
import macros
|
||||
|
||||
macro thirteen(args: varargs[expr]): expr =
|
||||
result = newIntLitNode(13)
|
||||
|
||||
doAssert(13==thirteen([1,2])) # works
|
||||
doAssert(13==thirteen(1,2)) # works
|
||||
|
||||
doAssert(13==thirteen(1,[2])) # does not work
|
||||
doAssert(13==thirteen([1], 2)) # does not work
|
||||
|
||||
echo "success"
|
||||
Loading…
Add table
Add a link
Reference in a new issue