This commit is contained in:
ringabout
2026-04-01 19:16:52 +08:00
parent 9182c03d47
commit 1e837ca727
2 changed files with 2 additions and 4 deletions

View File

@@ -232,8 +232,7 @@ proc evalTypeTrait(c: PContext; traitCall: PNode, operand: PType, context: PSym)
of "stripGenericParams":
result = uninstantiate(operand).toNode(traitCall.info)
of "supportsCopyMem":
let complexObj = supportsCopyMem(operand)
result = newIntNodeT(toInt128(ord(not complexObj)), traitCall, c.idgen, c.graph)
result = newIntNodeT(toInt128(ord(supportsCopyMem(operand))), traitCall, c.idgen, c.graph)
of "canFormCycles":
result = newIntNodeT(toInt128(ord(types.canFormAcycle(c.graph, operand))), traitCall, c.idgen, c.graph)
of "hasDefaultValue":

View File

@@ -1782,5 +1782,4 @@ proc reduceToBase*(f: PType): PType =
proc supportsCopyMem*(t: PType): bool =
let t = t.skipTypes({tyVar, tyLent, tyGenericInst, tyAlias, tySink, tyInferred})
result = containsGarbageCollectedRef(t) or
hasDestructor(t)
result = not containsGarbageCollectedRef(t) and not hasDestructor(t)