summary refs log tree commit diff stats
path: root/doc
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-12-19 17:24:22 +0800
committerGitHub <noreply@github.com>2023-12-19 10:24:22 +0100
commit434e062e82b21ace37abb16f7388c07df74a0729 (patch)
treee2c6fc8289762fd8fc4941141cbd755a5662dc3d /doc
parent0f54554213af767e6bec25250fc9c902316b5266 (diff)
downloadNim-434e062e82b21ace37abb16f7388c07df74a0729.tar.gz
fixes #18073; fixes #14730; document notnil is only applied to local … (#23084)
…symbols

fixes #18073
fixes #14730
Diffstat (limited to 'doc')
-rw-r--r--doc/manual_experimental.md10
1 files changed, 7 insertions, 3 deletions
diff --git a/doc/manual_experimental.md b/doc/manual_experimental.md
index f5e39b768..3b552ef8e 100644
--- a/doc/manual_experimental.md
+++ b/doc/manual_experimental.md
@@ -560,7 +560,8 @@ Not nil annotation
 `{.experimental: "notnil".}`.
 
 All types for which `nil` is a valid value can be annotated with the
-`not nil` annotation to exclude `nil` as a valid value:
+`not nil` annotation to exclude `nil` as a valid value. Note that only local
+symbols are checked.
 
   ```nim
   {.experimental: "notnil".}
@@ -577,8 +578,11 @@ All types for which `nil` is a valid value can be annotated with the
   p(nil)
 
   # and also this:
-  var x: PObject
-  p(x)
+  proc foo =
+    var x: PObject
+    p(x)
+
+  foo()
   ```
 
 The compiler ensures that every code path initializes variables which contain