From 4a35d2b571190e94e151091535793cd033b589b1 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Sun, 2 Jun 2019 06:33:35 +0200 Subject: fixes #11375 (#11376) --- compiler/sigmatch.nim | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'compiler') diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 339af007a..19ceb61ca 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -1480,6 +1480,15 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, #InternalError("typeRel: tyGenericInvocation -> tyGenericInvocation") # simply no match for now: discard + elif x.kind == tyGenericInst and f.sons[0] == x.sons[0] and + sonsLen(x) - 1 == sonsLen(f): + for i in 1 ..< sonsLen(f): + if x.sons[i].kind == tyGenericParam: + internalError(c.c.graph.config, "wrong instantiated type!") + elif typeRel(c, f.sons[i], x.sons[i]) <= isSubtype: + # Workaround for regression #4589 + if f.sons[i].kind != tyTypeDesc: return + result = isGeneric elif x.kind == tyGenericInst and isGenericSubType(c, x, f, depth, f) and (sonsLen(x) - 1 == sonsLen(f)): # do not recurse here in order to not K bind twice for this code: @@ -1492,15 +1501,6 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, # x.setColor() c.inheritancePenalty += depth result = isGeneric - elif x.kind == tyGenericInst and f.sons[0] == x.sons[0] and - sonsLen(x) - 1 == sonsLen(f): - for i in 1 ..< sonsLen(f): - if x.sons[i].kind == tyGenericParam: - internalError(c.c.graph.config, "wrong instantiated type!") - elif typeRel(c, f.sons[i], x.sons[i]) <= isSubtype: - # Workaround for regression #4589 - if f.sons[i].kind != tyTypeDesc: return - result = isGeneric else: let genericBody = f.sons[0] var askip = skippedNone -- cgit 1.4.1-2-gfad0