mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-15 23:54:19 +00:00
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:
10
changelog.md
10
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`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user