summary refs log tree commit diff stats
diff options
context:
space:
mode:
authormetagn <metagngn@gmail.com>2022-09-20 15:58:22 +0300
committerGitHub <noreply@github.com>2022-09-20 14:58:22 +0200
commit3dc302662e2665a0c1467a290c689f40d8a2e263 (patch)
tree7a7eeb52ee97c3e8ee2f251bf4f4b05ad95000a2
parent08c02f0236eec5957d54cc7f263461e06cb09a2a (diff)
downloadNim-3dc302662e2665a0c1467a290c689f40d8a2e263.tar.gz
clarify distinct pointer type `nil` change (#20376)
* clarify distinct pointer type `nil` change

* Update changelog.md [skip ci]

Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>

* remove extra quote [skip ci]

Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
-rw-r--r--changelog.md10
1 files changed, 9 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md
index 9364ab573..3281f6526 100644
--- a/changelog.md
+++ b/changelog.md
@@ -29,7 +29,15 @@
 - `nimPreviewDotLikeOps` is going to be removed or deprecated.
 
 - The `{.this.}` pragma, deprecated since 0.19, has been removed.
-- `nil` is no longer a valid value for distinct pointer types.
+- `nil` literals can no longer be directly assigned to variables or fields of `distinct` pointer types. They must be converted instead.
+  ```nim
+  type Foo = distinct ptr int
+
+  # Before:
+  var x: Foo = nil
+  # After:
+  var x: Foo = Foo(nil)
+  ```
 - Removed two type pragma syntaxes deprecated since 0.20, namely
   `type Foo = object {.final.}`, and `type Foo {.final.} [T] = object`.