Nim
Nim copied to clipboard
Regression in ORC, not `refc`, from `v2.2.4` to `version-2-2`/`devel` with `{.global.}` variable in recursive function
Nim Version
Runs in both refc and ORC:
Nim Compiler Version 2.2.4 [Linux: amd64]
Compiled at 2025-06-08
Copyright (c) 2006-2025 by Andreas Rumpf
git hash: f7145dd26efeeeb6eeae6fff649db244d81b212d
active boot switches: -d:release
Runs in refc but asserts in ORC:
Nim Compiler Version 2.2.5 [Linux: amd64]
Compiled at 2025-06-15
Copyright (c) 2006-2025 by Andreas Rumpf
git hash: 7fdbdb2f20a9d43e62afac8c32dfd3a3e39d3149
active boot switches: -d:release
Nim Compiler Version 2.3.1 [Linux: amd64]
Compiled at 2025-06-15
Copyright (c) 2006-2025 by Andreas Rumpf
git hash: 7701b3c7e6f6c640a89cc445b40f466834ab4fcf
active boot switches: -d:release
Description
type R = ref object
type B = object
j: int
proc y(T: type): R
proc u(T: type): R =
let res {.global.} = y(T)
res
proc y(T: type): R =
when T is object:
doAssert not isNil(u(typeof(B.j)))
R()
discard u(B)
Current Output
Error: unhandled exception: /tmp/w.nim(10, 5) `not isNil(u(typeof(B.j)))` [AssertionDefect]
Expected Output
No such AssertionDefect
Known Workarounds
No response
Additional Information
No response