Skip to content

raise CatchableError is broken with --gc:arc when throwing inside a proc #13599

@timotheecour

Description

@timotheecour

raise CatchableError is broken with --gc:arc when throwing inside a proc.
This bug is different from #13585, eg here the behavior depends on whether raise is at proc or module level; also #13585 was only for doAssert, not raise newException(CatchableError, "foo"), whereas here the bug is for raise newException(CatchableError, "foo")

Example

proc main() = # would work if at top-level instead of inside proc
  try:
    echo "before"
    raise newException(CatchableError, "foo")
  # except CatchableError: # would work
  except AssertionError:
    echo "caught"
  echo "after"
main()

Current Output

before
after

Expected Output

should be same as we have without --gc:arc or with try/catch at module-level

before
...
Error: unhandled exception: foo [CatchableError]

Additional Information

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions