diff --git a/compiler/ast.nim b/compiler/ast.nim index f665444b17..2b428cec09 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -775,7 +775,7 @@ type # formal param list # for concepts, the concept body # else: unused - owner*: PSym # the 'owner' of the type + ownerField: PSym # the 'owner' of the type sym*: PSym # types have the sym associated with them # it is used for converting types to strings size*: BiggestInt # the size of the type in bytes @@ -814,7 +814,7 @@ type template nodeId(n: PNode): int = cast[int](n) -template owner*(s: PSym): PSym = +template owner*(s: PSym|PType): PSym = s.ownerField type Gconfig = object @@ -1506,7 +1506,7 @@ iterator signature*(t: PType): PType = proc newType*(kind: TTypeKind; idgen: IdGenerator; owner: PSym; son: sink PType = nil): PType = let id = nextTypeId idgen - result = PType(kind: kind, owner: owner, size: defaultSize, + result = PType(kind: kind, ownerField: owner, size: defaultSize, align: defaultAlignment, itemId: id, uniqueId: id, sons: @[]) if son != nil: result.sons.add son @@ -1561,7 +1561,7 @@ proc copyType*(t: PType, idgen: IdGenerator, owner: PSym): PType = result.sym = t.sym # backend-info should not be copied proc exactReplica*(t: PType): PType = - result = PType(kind: t.kind, owner: t.owner, size: defaultSize, + result = PType(kind: t.kind, ownerField: t.owner, size: defaultSize, align: defaultAlignment, itemId: t.itemId, uniqueId: t.uniqueId) assignType(result, t) diff --git a/compiler/ic/ic.nim b/compiler/ic/ic.nim index 23cff281b7..238825ac56 100644 --- a/compiler/ic/ic.nim +++ b/compiler/ic/ic.nim @@ -998,7 +998,7 @@ proc typeHeaderFromPacked(c: var PackedDecoder; g: var PackedModuleGraph; proc typeBodyFromPacked(c: var PackedDecoder; g: var PackedModuleGraph; t: PackedType; si, item: int32; result: PType) = result.sym = loadSym(c, g, si, t.sym) - result.owner = loadSym(c, g, si, t.owner) + result.owner() = loadSym(c, g, si, t.owner) when false: for op, item in pairs t.attachedOps: result.attachedOps[op] = loadSym(c, g, si, item) diff --git a/compiler/semdata.nim b/compiler/semdata.nim index 16d3d6f5b8..1888d8f6e1 100644 --- a/compiler/semdata.nim +++ b/compiler/semdata.nim @@ -529,10 +529,11 @@ template localErrorNode*(c: PContext, n: PNode, arg: string): PNode = liMessage(c.config, n2.info, errGenerated, arg, doNothing, instLoc()) errorNode(c, n2) -proc fillTypeS*(dest: PType, kind: TTypeKind, c: PContext) = - dest.kind = kind - dest.owner = getCurrOwner(c) - dest.size = - 1 +when false: + proc fillTypeS*(dest: PType, kind: TTypeKind, c: PContext) = + dest.kind = kind + dest.owner = getCurrOwner(c) + dest.size = - 1 proc makeRangeType*(c: PContext; first, last: BiggestInt; info: TLineInfo; intType: PType = nil): PType =