This commit is contained in:
Araq
2015-03-22 00:27:26 +01:00
parent 1681800d3c
commit 0d804c2052
4 changed files with 17 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
#
#
# The Nim Compiler
# (c) Copyright 2013 Andreas Rumpf
# (c) Copyright 2015 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.

View File

@@ -1537,7 +1537,9 @@ proc matchesAux(c: PContext, n, nOrig: PNode,
copyTree(n.sons[a]), m, c))
else:
addSon(m.call, copyTree(n.sons[a]))
elif formal != nil:
elif formal != nil and formal.typ.kind == tyVarargs:
# beware of the side-effects in 'prepareOperand'! So only do it for
# varags matching. See tests/metatype/tstatic_overloading.
m.baseTypeMatch = false
n.sons[a] = prepareOperand(c, formal.typ, n.sons[a])
var arg = paramTypesMatch(m, formal.typ, n.sons[a].typ,

View File

@@ -919,6 +919,9 @@ proc sameTypeAux(x, y: PType, c: var TSameTypeClosure): bool =
result = sameFlags(a, b)
of tyStatic, tyFromExpr:
result = exprStructuralEquivalent(a.n, b.n) and sameFlags(a, b)
if result and a.len == b.len and a.len == 1:
cycleCheck()
result = sameTypeAux(a.sons[0], b.sons[0], c)
of tyObject:
ifFastObjectTypeCheckFailed(a, b):
cycleCheck()

View File

@@ -0,0 +1,10 @@
# bug #2266
import macros
proc impl(op: static[int]) = echo "impl 1 called"
proc impl(op: static[int], init: int) = echo "impl 2 called"
macro wrapper2: stmt = newCall(bindSym"impl", newLit(0), newLit(0))
wrapper2() # Code generation for this fails.