summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/lowerings.nim8
-rw-r--r--compiler/sempass2.nim5
2 files changed, 12 insertions, 1 deletions
diff --git a/compiler/lowerings.nim b/compiler/lowerings.nim
index d372ac0c1..0922ab088 100644
--- a/compiler/lowerings.nim
+++ b/compiler/lowerings.nim
@@ -150,11 +150,18 @@ proc createObj*(g: ModuleGraph; owner: PSym, info: TLineInfo; final=true): PType
   s.typ = result
   result.sym = s
 
+template fieldCheck {.dirty.} =
+  when false:
+    if tfCheckedForDestructor in obj.flags:
+      echo "missed field ", field.name.s
+      writeStackTrace()
+
 proc rawAddField*(obj: PType; field: PSym) =
   assert field.kind == skField
   field.position = len(obj.n)
   addSon(obj.n, newSymNode(field))
   propagateToOwner(obj, field.typ)
+  fieldCheck()
 
 proc rawIndirectAccess*(a: PNode; field: PSym; info: TLineInfo): PNode =
   # returns a[].field as a node
@@ -208,6 +215,7 @@ proc addField*(obj: PType; s: PSym; cache: IdentCache) =
   propagateToOwner(obj, t)
   field.position = len(obj.n)
   addSon(obj.n, newSymNode(field))
+  fieldCheck()
 
 proc addUniqueField*(obj: PType; s: PSym; cache: IdentCache): PSym {.discardable.} =
   result = lookupInRecord(obj.n, s.id)
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim
index ef0dcec00..00afb737d 100644
--- a/compiler/sempass2.nim
+++ b/compiler/sempass2.nim
@@ -855,6 +855,8 @@ proc track(tracked: PEffects, n: PNode) =
       if x.sons[0].kind == nkSym and sfDiscriminant in x.sons[0].sym.flags:
         addDiscriminantFact(tracked.guards, x)
     setLen(tracked.guards.s, oldFacts)
+    if tracked.owner.kind != skMacro:
+      createTypeBoundOps(tracked, n.typ, n.info)
   of nkPragmaBlock:
     let pragmaList = n.sons[0]
     let oldLocked = tracked.locked.len
@@ -885,7 +887,8 @@ proc track(tracked: PEffects, n: PNode) =
     if n.len == 1: track(tracked, n.sons[0])
   of nkBracket:
     for i in 0 ..< safeLen(n): track(tracked, n.sons[i])
-    createTypeBoundOps(tracked, n.typ, n.info)
+    if tracked.owner.kind != skMacro:
+      createTypeBoundOps(tracked, n.typ, n.info)
   else:
     for i in 0 ..< safeLen(n): track(tracked, n.sons[i])