diff options
author | cooldome <ariabushenko@gmail.com> | 2021-01-15 18:16:24 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-15 18:16:24 +0000 |
commit | fc9cf2088d8ba969115a335239d57c05fbee9ad4 (patch) | |
tree | 657b04a36bac4bb1ffdf9993cb2f183571bf2554 /compiler | |
parent | 52cf7280019c943dd7df33d0dd693931e6a116ee (diff) | |
download | Nim-fc9cf2088d8ba969115a335239d57c05fbee9ad4.tar.gz |
Fix 16722 (#16730)
* fix #16722 * fix spacing * spacing
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ccgtypes.nim | 5 | ||||
-rw-r--r-- | compiler/liftdestructors.nim | 2 | ||||
-rw-r--r-- | compiler/transf.nim | 2 |
3 files changed, 6 insertions, 3 deletions
diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index 798eaf7f9..e7e9d97d8 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -1330,7 +1330,7 @@ proc genHook(m: BModule; t: PType; info: TLineInfo; op: TTypeAttachedOp): Rope = proc genTypeInfoV2Impl(m: BModule, t, origType: PType, name: Rope; info: TLineInfo) = var typeName: Rope - if t.kind == tyObject: + if t.kind in {tyObject, tyDistinct}: if incompleteType(t): localError(m.config, info, "request for RTTI generation for incomplete object: " & typeToString(t)) @@ -1353,7 +1353,8 @@ proc genTypeInfoV2Impl(m: BModule, t, origType: PType, name: Rope; info: TLineIn proc genTypeInfoV2(m: BModule, t: PType; info: TLineInfo): Rope = let origType = t - var t = skipTypes(origType, irrelevantForBackend + tyUserTypeClasses) + # distinct types can have their own destructors + var t = skipTypes(origType, irrelevantForBackend + tyUserTypeClasses - {tyDistinct}) let prefixTI = if m.hcrOn: "(" else: "(&" diff --git a/compiler/liftdestructors.nim b/compiler/liftdestructors.nim index 5ffa25e53..f79742389 100644 --- a/compiler/liftdestructors.nim +++ b/compiler/liftdestructors.nim @@ -361,7 +361,7 @@ proc considerAsgnOrSink(c: var TLiftCtx; t: PType; body, x, y: PNode; result = true proc addDestructorCall(c: var TLiftCtx; orig: PType; body, x: PNode) = - let t = orig.skipTypes(abstractInst) + let t = orig.skipTypes(abstractInst - {tyDistinct}) var op = t.destructor if op != nil and sfOverriden in op.flags: diff --git a/compiler/transf.nim b/compiler/transf.nim index daf223106..255f29546 100644 --- a/compiler/transf.nim +++ b/compiler/transf.nim @@ -524,6 +524,7 @@ proc transformConv(c: PTransf, n: PNode): PNode = result[0] = transform(c, n[1]) else: result = transform(c, n[1]) + result.typ = n.typ else: result = transformSons(c, n) of tyObject: @@ -536,6 +537,7 @@ proc transformConv(c: PTransf, n: PNode): PNode = result[0] = transform(c, n[1]) else: result = transform(c, n[1]) + result.typ = n.typ of tyGenericParam, tyOrdinal: result = transform(c, n[1]) # happens sometimes for generated assignments, etc. |