out parameters: enforce that 'out' is only used as a parameter (#20510)

* out parameters: enforce that 'out' is only used as a parameter

* make tables.nim use 'out' parameters

* better backwards compat
This commit is contained in:
Andreas Rumpf 2022-10-07 22:26:53 +02:00 • committed by GitHub
commit e83f27e6a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 47 additions and 3 deletions

View file

@ -65,6 +65,8 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind,
elif t.kind == tyLent and ((kind != skResult and views notin c.features) or
kind == skParam): # lent can't be used as parameters.
result = t
elif isOutParam(t) and kind != skParam:
result = t
else:
var t2 = skipTypes(t[0], abstractInst-{tyTypeDesc, tySink})
case t2.kind