fixes #24996; Crash on marking destroy hook as .error (#25002)

fixes #24996

uses the lineinfos of `dest` is `ri` is not available (e.g. `=destroy`
doesn't have a second parameter)
This commit is contained in:
ringabout
2025-06-17 03:50:06 +08:00
committed by GitHub
parent 8e5ed5dbb7
commit c22bfe6bc0
2 changed files with 22 additions and 2 deletions

14
tests/errmsgs/t24996.nim Normal file
View File

@@ -0,0 +1,14 @@
discard """
errormsg: "'=destroy' is not available for type <X>; routine: main"
joinable: false
"""
type X = object
proc `=destroy`(x: X) {.error.} =
discard
proc main() =
var x = X()
main()