summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-11-07 02:36:26 +0800
committerGitHub <noreply@github.com>2023-11-06 19:36:26 +0100
commit2e070dfc76a1badfaad08d62b0f3f02f6ba2bc02 (patch)
tree918bf713c28a821a3c1216ac2feeb12c011f109a /tests
parentb79b39128e1416dfe04dea4abee7a1c5d917605e (diff)
downloadNim-2e070dfc76a1badfaad08d62b0f3f02f6ba2bc02.tar.gz
fixes #22673; Cannot prove that result is initialized for a placehold… (#22915)
…er base method returning a lent


fixes #22673
Diffstat (limited to 'tests')
-rw-r--r--tests/method/t22673.nim21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/method/t22673.nim b/tests/method/t22673.nim
new file mode 100644
index 000000000..1689e9d42
--- /dev/null
+++ b/tests/method/t22673.nim
@@ -0,0 +1,21 @@
+discard """
+  matrix: "--warningAsError:UseBase"
+"""
+
+# bug #22673
+type RefEntry = ref object of RootObj
+
+type RefFile = ref object of RefEntry
+    filename*: string
+    data*: string
+
+type RefDir = ref object of RefEntry
+    dirname*: string
+    files*: seq[RefFile]
+
+method name*(e: RefEntry): lent string {.base.} =
+  raiseAssert "Don't call the base method"
+
+method name*(e: RefFile): lent string = e.filename
+
+method name*(e: RefDir): lent string = e.dirname
\ No newline at end of file