Show field not initialized warning only when notnil used (#10155)

This commit is contained in:
Neelesh Chandola
2019-01-01 23:19:44 +05:30
committed by Andreas Rumpf
parent 9faad7591e
commit 6ed9676af5

View File

@@ -141,7 +141,7 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType =
if isPure and (let conflict = strTableInclReportConflict(symbols, e); conflict != nil):
wrongRedefinition(c, e.info, e.name.s, conflict.info)
inc(counter)
if not hasNull: incl(result.flags, tfNeedsInit)
if tfNotNil in e.typ.flags and not hasNull: incl(result.flags, tfNeedsInit)
proc semSet(c: PContext, n: PNode, prev: PType): PType =
result = newOrPrevType(tySet, prev, c)