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>
This commit is contained in:
metagn
2022-09-20 15:58:22 +03:00
committed by GitHub
parent 08c02f0236
commit 3dc302662e

View File

@@ -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`.