From 434e062e82b21ace37abb16f7388c07df74a0729 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Tue, 19 Dec 2023 17:24:22 +0800 Subject: [PATCH] =?UTF-8?q?fixes=20#18073;=20fixes=20#14730;=20document=20?= =?UTF-8?q?notnil=20is=20only=20applied=20to=20local=20=E2=80=A6=20(#23084?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …symbols fixes #18073 fixes #14730 --- doc/manual_experimental.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/manual_experimental.md b/doc/manual_experimental.md index f5e39b768b..3b552ef8e5 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