make 'not nil' experimental

This commit is contained in:
Andreas Rumpf 2018-05-01 10:48:46 +02:00 • committed by Araq
commit 599b5d6dcb
14 changed files with 27 additions and 16 deletions

View file

@ -116,3 +116,4 @@ proc initDefines*() =
defineSymbol("nimVmEqIdent")
defineSymbol("nimNoNil")
defineSymbol("nimNoZeroTerminator")
defineSymbol("nimNotNil")

View file

@ -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]

View file

@ -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: