make 'not nil' experimental
This commit is contained in:
parent
cc0ca43743
commit
599b5d6dcb
14 changed files with 27 additions and 16 deletions
|
|
@ -116,3 +116,4 @@ proc initDefines*() =
|
|||
defineSymbol("nimVmEqIdent")
|
||||
defineSymbol("nimNoNil")
|
||||
defineSymbol("nimNoZeroTerminator")
|
||||
defineSymbol("nimNotNil")
|
||||
|
|
|
|||
|
|
@ -109,7 +109,8 @@ type
|
|||
dotOperators,
|
||||
callOperator,
|
||||
parallel,
|
||||
destructor
|
||||
destructor,
|
||||
notnil
|
||||
|
||||
ConfigRef* = ref object ## eventually all global configuration should be moved here
|
||||
cppDefines*: HashSet[string]
|
||||
|
|
|
|||
|
|
@ -1389,6 +1389,8 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType =
|
|||
n.sons[2].kind == nkNilLit:
|
||||
result = freshType(result, prev)
|
||||
result.flags.incl(tfNotNil)
|
||||
if notnil notin c.features:
|
||||
localError(n.info, "enable the 'not nil' annotation with {.experimental: \"notnil\".}")
|
||||
else:
|
||||
localError(n.info, errGenerated, "invalid type")
|
||||
of 2:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue