summary refs log tree commit diff stats
path: root/compiler/semtypinst.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/semtypinst.nim')
-rw-r--r--compiler/semtypinst.nim21
1 files changed, 10 insertions, 11 deletions
diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim
index 029bf6c8c..fb7be3a38 100644
--- a/compiler/semtypinst.nim
+++ b/compiler/semtypinst.nim
@@ -263,25 +263,24 @@ proc propagateFieldFlags(t: PType, n: PNode) =
   of nkSym:
     propagateToOwner(t, n.sym.typ)
   of nkRecList, nkRecCase, nkOfBranch, nkElse:
-    for son in n.sons:
-      propagateFieldFlags(t, son)
+    if n.sons != nil:
+      for son in n.sons:
+        propagateFieldFlags(t, son)
   else: discard
 
 proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType =
   result = t
   if t == nil: return
 
-  if t.kind == tyStatic and t.sym != nil and t.sym.kind == skGenericParam:
-    let s = lookupTypeVar(cl, t)
-    return if s != nil: s else: t
+  #if t.kind == tyStatic and t.sym != nil and t.sym.kind == skGenericParam:
+  #  let s = lookupTypeVar(cl, t)
+  #  return if s != nil: s else: t
+
+  if t.kind in {tyStatic, tyGenericParam} + tyTypeClasses:
+    let lookup = PType(idTableGet(cl.typeMap, t))
+    if lookup != nil: return lookup
 
   case t.kind
-  of tyGenericParam, tyTypeClasses:
-    let lookup = lookupTypeVar(cl, t)
-    if lookup != nil:
-      result = lookup
-      if result.kind == tyGenericInvokation:
-        result = handleGenericInvokation(cl, result)
   of tyGenericInvokation:
     result = handleGenericInvokation(cl, t)
   of tyGenericBody: