summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2024-05-16 02:52:18 +0800
committerGitHub <noreply@github.com>2024-05-15 20:52:18 +0200
commit2c8551556e5b51b7a7e487b1043b92d4ad34dbf0 (patch)
treeb423c469d9caa64c38d145d701b507a0893c9175 /tests
parentc08356865da1386a4c999e7d2df23f13979a5c05 (diff)
downloadNim-2c8551556e5b51b7a7e487b1043b92d4ad34dbf0.tar.gz
fixes lifting subtype calling parent's hooks (#23612)
ref https://forum.nim-lang.org/t/11587

Tested with `gcc version 14.0.1 20240412` locally
Diffstat (limited to 'tests')
-rw-r--r--tests/arc/tarc_orc.nim25
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/arc/tarc_orc.nim b/tests/arc/tarc_orc.nim
index 594950d71..674ba0dbb 100644
--- a/tests/arc/tarc_orc.nim
+++ b/tests/arc/tarc_orc.nim
@@ -136,4 +136,27 @@ proc main2 =
     doAssert a.len == 2
     doAssert b.len == 0
 
-main2()
\ No newline at end of file
+main2()
+
+block:
+  type
+    TestObj = object of RootObj
+      name: string
+    
+    TestSubObj = object of TestObj
+      objname: string
+
+  proc `=destroy`(x: TestObj) =
+    `=destroy`(x.name)
+
+  proc `=destroy`(x: TestSubObj) =
+    `=destroy`(x.objname)
+    `=destroy`(TestObj(x))
+
+  proc testCase() =
+    let t1 {.used.} = TestSubObj(objname: "tso1", name: "to1")
+
+  proc main() =
+    testCase()
+
+  main()