document not-nil issues

This commit is contained in:
Jacek Sieka 2020-10-27 13:00:45 +01:00
parent 4caaf86332
commit 6050eebec0
No known key found for this signature in database
GPG Key ID: A1B09461ABB656B8
1 changed files with 9 additions and 0 deletions

View File

@ -17,6 +17,9 @@
# `ref` - this can be achieved by wrapping them in higher-level
# types / composition
# TODO Careful, not nil analysis is broken / incomplete and the semantics will
# likely change in future versions of the language:
# https://github.com/nim-lang/RFCs/issues/250
{.experimental: "notnil".}
{.push raises: [Defect].}
@ -339,6 +342,9 @@ type
current_justified_checkpoint*: Checkpoint
finalized_checkpoint*: Checkpoint
# TODO Careful, not nil analysis is broken / incomplete and the semantics will
# likely change in future versions of the language:
# https://github.com/nim-lang/RFCs/issues/250
BeaconStateRef* = ref BeaconState not nil
NilableBeaconStateRef* = ref BeaconState
@ -623,6 +629,9 @@ template assignClone*[T: not ref](x: T): ref T =
assign(res[], x)
res
# TODO Careful, not nil analysis is broken / incomplete and the semantics will
# likely change in future versions of the language:
# https://github.com/nim-lang/RFCs/issues/250
template newClone*[T](x: ref T not nil): ref T =
newClone(x[])