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
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): if isPure and (let conflict = strTableInclReportConflict(symbols, e); conflict != nil):
wrongRedefinition(c, e.info, e.name.s, conflict.info) wrongRedefinition(c, e.info, e.name.s, conflict.info)
inc(counter) 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 = proc semSet(c: PContext, n: PNode, prev: PType): PType =
result = newOrPrevType(tySet, prev, c) result = newOrPrevType(tySet, prev, c)