fix #16150 improve type mismatch errors (#16152)

* fix #16150 improve type mismatch errors

* allow -d:nimLegacyTypeMismatch

* address comment
This commit is contained in:
Timothee Cour
2020-12-09 07:19:39 -08:00
committed by GitHub
parent 87e634aab3
commit f344a70412
7 changed files with 14 additions and 7 deletions

View File

@@ -1745,7 +1745,7 @@ proc semAsgn(c: PContext, n: PNode; mode=asgnNormal): PNode =
c.p.resultSym.typ = rhsTyp
c.p.owner.typ[0] = rhsTyp
else:
typeMismatch(c.config, n.info, lhs.typ, rhsTyp)
typeMismatch(c.config, n.info, lhs.typ, rhsTyp, rhs)
borrowCheck(c, n, lhs, rhs)
n[1] = fitNode(c, le, rhs, goodLineInfo(n[1]))