fixes #14498 [backport:1.2] (#14503)

This commit is contained in:
Andreas Rumpf
2020-05-30 15:32:31 +02:00
committed by GitHub
parent 3105909f88
commit 7ccc7d7e93
4 changed files with 26 additions and 6 deletions

View File

@@ -1712,7 +1712,7 @@ proc semAsgn(c: PContext, n: PNode; mode=asgnNormal): PNode =
if le == nil:
localError(c.config, a.info, "expression has no type")
elif (skipTypes(le, {tyGenericInst, tyAlias, tySink}).kind != tyVar and
isAssignable(c, a) == arNone) or
isAssignable(c, a) in {arNone, arLentValue}) or
skipTypes(le, abstractVar).kind in {tyOpenArray, tyVarargs}:
# Direct assignment to a discriminant is allowed!
localError(c.config, a.info, errXCannotBeAssignedTo %