diff options
author | Neelesh Chandola <neelesh.chandola@outlook.com> | 2019-01-01 23:19:44 +0530 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-01-01 18:49:44 +0100 |
commit | 6ed9676af5ae17fa15551a00f1ad5f3be109233f (patch) | |
tree | 0998838dd2ffa582fb5d5be712d337006dec98b3 | |
parent | 9faad7591e37fa074544206d1de17e59f56bd576 (diff) | |
download | Nim-6ed9676af5ae17fa15551a00f1ad5f3be109233f.tar.gz |
Show field not initialized warning only when `notnil` used (#10155)
-rw-r--r-- | compiler/semtypes.nim | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index d1ea54eca..f4936a71a 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -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) |