Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #18073; fixes #14730; document notnil is only applied to local … #23084

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

ringabout
Copy link
Member

…symbols

fixes #18073
fixes #14730

@@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But globals should be checked too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trackProc function only tracks local symbols. Similarly as this case, the strictdef analysis is applied to local symbols. I suppose it's hard to analyze global symbols, which might be used in functions arbitrarily.

Globals are only checked by the direct illegal assignment if that is what you meant. I will rephrase it better.

Or I might miss something?

@Araq Araq merged commit 434e062 into devel Dec 19, 2023
22 checks passed
@Araq Araq deleted the ringabout-patch-1 branch December 19, 2023 09:24
Copy link
Contributor

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from 434e062

Hint: mm: orc; opt: speed; options: -d:release
177491 lines; 7.861s; 765.918MiB peakmem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiler doesn't catch Not nil annotation error Uninitialized not nil ref/ptr is nil
2 participants