diff options
author | Araq <rumpf_a@web.de> | 2015-04-24 20:28:39 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-04-25 23:16:58 +0200 |
commit | 2c91e999e29208f89ab6b0995b6942b69a1e23e3 (patch) | |
tree | ad57e2df4e51328913e6c1c5d8b70d7d592784e7 /compiler | |
parent | ecc009093933887ab692efd5db099d752a1d2e6b (diff) | |
download | Nim-2c91e999e29208f89ab6b0995b6942b69a1e23e3.tar.gz |
fixes #2600
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/sigmatch.nim | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 5c8a3bc58..aad6b590e 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -147,6 +147,7 @@ proc copyCandidate(a: var TCandidate, b: TCandidate) = proc sumGeneric(t: PType): int = var t = t + var isvar = 1 while true: case t.kind of tyGenericInst, tyArray, tyRef, tyPtr, tyDistinct, tyArrayConstr, @@ -154,8 +155,9 @@ proc sumGeneric(t: PType): int = t = t.lastSon inc result of tyVar: - # but do not make 'var T' more specific than 'T'! t = t.sons[0] + inc result + inc isvar of tyGenericInvocation, tyTuple: result = ord(t.kind == tyGenericInvocation) for i in 0 .. <t.len: result += t.sons[i].sumGeneric @@ -164,7 +166,7 @@ proc sumGeneric(t: PType): int = of tyBool, tyChar, tyEnum, tyObject, tyProc, tyPointer, tyString, tyCString, tyInt..tyInt64, tyFloat..tyFloat128, tyUInt..tyUInt64: - return 1 + return isvar else: return 0 #var ggDebug: bool @@ -1470,9 +1472,7 @@ proc matchesAux(c: PContext, n, nOrig: PNode, m.state = csNoMatch return if formal.typ.kind == tyVar: - if n.isLValue: - inc(m.genericMatches, 100) - else: + if not n.isLValue: m.state = csNoMatch return |