fixes 'lent T' inside object constructor [backport] (#18911)

* fixes 'lent T' inside object constructor [backport]

* progress
This commit is contained in:
Andreas Rumpf 2021-09-27 22:23:31 +02:00 • committed by GitHub
commit 576fece909
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 3 deletions

View file

@ -545,7 +545,7 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
else:
# BUGFIX: ``fitNode`` is needed here!
# check type compatibility between def.typ and typ
def = fitNodeForLocalVar(c, typ, def, def.info)
def = fitNodeConsiderViewType(c, typ, def, def.info)
#changeType(def.skipConv, typ, check=true)
else:
typ = def.typ.skipTypes({tyStatic, tySink}).skipIntLit(c.idgen)