diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-06-06 22:04:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-06 22:04:54 +0200 |
commit | bf394ed1a1d27d8d38d4bc386946e3442736cd75 (patch) | |
tree | 1a85620c296d890a1a8096876ac4b500e942854c /compiler/sigmatch.nim | |
parent | 68378c857dbb4cc6f4919501f42bd2995b31db03 (diff) | |
parent | 4262a85653e22e430824c92db35c5ee3bcecf954 (diff) | |
download | Nim-bf394ed1a1d27d8d38d4bc386946e3442736cd75.tar.gz |
Merge pull request #7550 from jangko/fix4799
fixes #4799, varargs now can accept polymorphic types
Diffstat (limited to 'compiler/sigmatch.nim')
-rw-r--r-- | compiler/sigmatch.nim | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 41cac2a4a..fcfdda8bb 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -2013,6 +2013,14 @@ proc paramTypesMatchAux(m: var TCandidate, f, a: PType, if r == isGeneric: result.typ = getInstantiatedType(c, arg, m, base(f)) m.baseTypeMatch = true + # bug #4799, varargs accepting subtype relation object + elif r == isSubtype: + inc(m.subtypeMatches) + if f.kind == tyTypeDesc: + result = arg + else: + result = implicitConv(nkHiddenSubConv, f, arg, m, c) + m.baseTypeMatch = true else: result = userConvMatch(c, m, base(f), a, arg) if result != nil: m.baseTypeMatch = true |