Replace tfHasRequiresInit with a more accurate mechanism
The new mechanism can deal with more complex scenarios such as not nil field appearing in a non-default case object branch or a field within a generic object that may depend on a when branch. The commit also plugs another hole: the user is no longer able to create illegal default values through seq.setLen(N).
This commit is contained in:
parent
d374c6373b
commit
ce9a4ed124
11 changed files with 179 additions and 43 deletions
|
|
@ -1090,7 +1090,7 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
|
|||
if sym.kind == skField:
|
||||
sym.flags.incl sfRequiresInit
|
||||
elif sym.typ != nil:
|
||||
incl(sym.typ.flags, tfRequiresInit)
|
||||
incl(sym.typ.flags, tfNeedsFullInit)
|
||||
else:
|
||||
invalidPragma(c, it)
|
||||
of wByRef:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue