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.nim21
1 files changed, 17 insertions, 4 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index 318acc660..78ae61d0f 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -751,11 +751,24 @@ proc matchUserTypeClass*(c: PContext, m: var TCandidate,
   # pushInfoContext(arg.info)
   openScope(c)
 
-  var testee = newSym(skParam, f.testeeName, f.sym, f.sym.info)
-  testee.typ = a
-  addDecl(c, testee)
+  for param in f.n[0]:
+    var
+      dummyName: PNode
+      dummyType: PType
+    
+    if param.kind == nkVarTy:
+      dummyName = param[0]
+      dummyType = makeVarType(c, a)
+    else:
+      dummyName = param
+      dummyType = a
+
+    InternalAssert dummyName.kind == nkIdent
+    var dummyParam = newSym(skParam, dummyName.ident, f.sym, f.sym.info)
+    dummyParam.typ = dummyType
+    addDecl(c, dummyParam)
 
-  for stmt in f.n:
+  for stmt in f.n[3]:
     var e = c.semTryExpr(c, copyTree(stmt))
     if e == nil:
       let expStr = renderTree(stmt, {renderNoComments})