Skip to content

Commit 7090f2a

Browse files
committed
cgirgen: don't turn distinct conversions into object ones
Fix the check for whether conversions are object conversion. This is necessary now that transf doesn't optimize these conversions away anymore.
1 parent b019388 commit 7090f2a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

compiler/backend/cgirgen.nim

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,10 @@ proc handleSpecialConv(c: ConfigRef, n: CgNode, info: TLineInfo,
193193
## between the source type (i.e. that of `n`) and the destination type.
194194
## If it is, generates the conversion operation IR and returns it -- nil
195195
## otherwise
196-
if dest.skipTypes(skipPtrs - {tyDistinct}).kind == tyObject:
197-
# if the destination is an object (or ptr/ref object), it must be an
198-
# object conversion
196+
if dest.skipTypes(skipPtrs - {tyDistinct}).kind == tyObject and
197+
n.typ.skipTypes(skipPtrs - {tyDistinct}).kind == tyObject:
198+
# if the destination and source are an object (or ptr/ref object), it must
199+
# be an object conversion
199200
genObjConv(n, dest, info)
200201
else:
201202
nil

0 commit comments

Comments
 (0)