summary refs log tree commit diff stats
path: root/compiler/sigmatch.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/sigmatch.nim')
-rw-r--r--compiler/sigmatch.nim20
1 files changed, 6 insertions, 14 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index f33ac76e7..162385e6d 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -1197,22 +1197,14 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation =
       else:
         return isNone
 
-  of tyUserTypeClass:
-    considerPreviousT:
-      var matched = matchUserTypeClass(c.c, c, f, aOrig)
-      if matched != nil:
-        # TODO, make user type classes skipable too
-        put(c, f, a)
-        result = isGeneric
-      else:
-        result = isNone
-
-  of tyUserTypeClassInst:
-    considerPreviousT:
+  of tyUserTypeClassInst, tyUserTypeClass:
+    if f.isResolvedUserTypeClass:
+      result = typeRel(c, f.lastSon, a)
+    else:
       var matched = matchUserTypeClass(c.c, c, f, aOrig)
       if matched != nil:
-        matched.sons.add a
-        put(c.bindings, f, matched)
+        bindConcreteTypeToUserTypeClass(matched, a)
+        put(c, f, matched)
         result = isGeneric
       else:
         result = isNone