From d11933ad998fb0a3eb51bbefbaa53e583aaa3ac1 Mon Sep 17 00:00:00 2001 From: jcosborn Date: Thu, 27 Aug 2020 05:56:38 -0500 Subject: [PATCH] fix some issues overloading with generics and inheritance (#15211) * fix some issues overloading with generics and inheritance * fix passing procs with subtype matches --- compiler/sigmatch.nim | 45 +++++++++++++++++++++------- tests/overload/toverload_various.nim | 36 ++++++++++++++++++---- 2 files changed, 65 insertions(+), 16 deletions(-) diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 1d648c32a2..8700d9a47e 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -199,6 +199,27 @@ proc copyCandidate(a: var TCandidate, b: TCandidate) = a.baseTypeMatch = b.baseTypeMatch copyIdTable(a.bindings, b.bindings) +proc typeRel*(c: var TCandidate, f, aOrig: PType, + flags: TTypeRelFlags = {}): TTypeRelation + +proc checkGeneric(a, b: TCandidate): int = + let c = a.c + let aa = a.callee + let bb = b.callee + var winner = 0 + for i in 1.. tyGenericInvocation") - # simply no match for now: - discard + if x.kind == tyGenericInvocation: + if f[0] == x[0]: + for i in 1..