Fix astdef typ deref (#10245)

This commit is contained in:
Alexander Ivanov 2019-04-05 17:43:36 +03:00 • committed by Andreas Rumpf
commit f101f09256
2 changed files with 12 additions and 3 deletions

View file

@ -336,7 +336,7 @@ proc checkNilable(c: PContext; v: PSym) =
{tfNotNil, tfNeedsInit} * v.typ.flags != {}:
if v.astdef.isNil:
message(c.config, v.info, warnProveInit, v.name.s)
elif tfNotNil in v.typ.flags and tfNotNil notin v.astdef.typ.flags:
elif tfNotNil in v.typ.flags and not v.astdef.typ.isNil and tfNotNil notin v.astdef.typ.flags:
message(c.config, v.info, warnProveInit, v.name.s)
#include liftdestructors