summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-06-02 06:33:35 +0200
committerGitHub <noreply@github.com>2019-06-02 06:33:35 +0200
commit4a35d2b571190e94e151091535793cd033b589b1 (patch)
treef1caff7561b003821835004045591f3852640586 /compiler
parentec038998f06887dbbc038c592c2c0bb37a00c28a (diff)
downloadNim-4a35d2b571190e94e151091535793cd033b589b1.tar.gz
fixes #11375 (#11376)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/sigmatch.nim18
1 files changed, 9 insertions, 9 deletions
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