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

@ -79,7 +79,7 @@ proc semConstrField(c: PContext, flags: TExprFlags,
var initValue = semExprFlagDispatched(c, assignment[1], flags)
if initValue != nil:
initValue = fitNode(c, field.typ, initValue, assignment.info)
initValue = fitNodeConsiderViewType(c, field.typ, initValue, assignment.info)
assignment[0] = newSymNode(field)
assignment[1] = initValue
assignment.flags.incl nfSem