fixes implicitConv discarding flags (#24817)

follow up https://github.com/nim-lang/Nim/pull/24809
ref https://github.com/nim-lang/Nim/pull/24815

(cherry picked from commit 58b1f28177)
This commit is contained in:
ringabout
2025-03-28 19:52:45 +08:00
committed by narimiran
parent 6864337dc2
commit 2c7577745b
2 changed files with 4 additions and 0 deletions

View File

@@ -2185,6 +2185,8 @@ proc implicitConv(kind: TNodeKind, f: PType, arg: PNode, m: TCandidate,
# keep varness
if arg.typ != nil and arg.typ.kind == tyVar:
result.typ() = toVar(result.typ, tyVar, c.idgen)
# copy the tfVarIsPtr flag
result.typ.flags = arg.typ.flags
else:
result.typ() = result.typ.skipTypes({tyVar})

View File

@@ -1,4 +1,6 @@
discard """
targets: "c cpp"
matrix: "--mm:refc; --mm:arc"
output: '''
it's nil
@[1, 2, 3]