Skip to content

Commit

Permalink
fixes the regressions caused by the fix for #20107 [backport] (#20287)
Browse files Browse the repository at this point in the history
* fixes the regressions caused by the fix for #20107 [backport]
  • Loading branch information
Araq authored Aug 31, 2022
1 parent d4c0d35 commit 5211a47
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions compiler/ccgexprs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ proc derefBlock(p: BProc, e: PNode, d: var TLoc) =
# We transform (block: x)[] to (block: x[])
let e0 = e[0]
var n = shallowCopy(e0)
n.typ = e.typ
for i in 0 ..< e0.len - 1:
n[i] = e0[i]
n[e0.len-1] = newTreeIT(nkHiddenDeref, e.info, e.typ, e0[e0.len-1])
Expand Down
2 changes: 1 addition & 1 deletion compiler/injectdestructors.nim
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ proc processScope(c: var Con; s: var Scope; ret: PNode): PNode =

template processScopeExpr(c: var Con; s: var Scope; ret: PNode, processCall: untyped): PNode =
assert not ret.typ.isEmptyType
var result = newNodeI(nkStmtListExpr, ret.info)
var result = newNodeIT(nkStmtListExpr, ret.info, ret.typ)
# There is a possibility to do this check: s.wasMoved.len > 0 or s.final.len > 0
# later and use it to eliminate the temporary when theres no need for it, but its
# tricky because you would have to intercept moveOrCopy at a certain point
Expand Down
1 change: 1 addition & 0 deletions tests/ccgbugs/tderefblock.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
discard """
cmd: "nim c -d:release -d:danger $file"
matrix: ";--gc:orc"
output: "42"
"""

Expand Down
1 change: 1 addition & 0 deletions tests/misc/t19600.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ discard """
targets: "c cpp"
disabled: "win"
disabled: "osx"
disabled: "linux"
exitcode: 1
outputsub: "No space left on device"
"""
Expand Down

0 comments on commit 5211a47

Please sign in to comment.