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

@@ -127,9 +127,10 @@ proc semForFields(c: PContext, n: PNode, m: TMagic): PNode =
localError(c.config, n.info, errGenerated, "no object or tuple type")
return result
for i in 1..<call.len:
var tupleTypeB = skipTypes(call[i].typ, skippedTypesForFields)
let calli = call[i]
var tupleTypeB = skipTypes(calli.typ, skippedTypesForFields)
if not sameType(tupleTypeA, tupleTypeB):
typeMismatch(c.config, call[i].info, tupleTypeA, tupleTypeB)
typeMismatch(c.config, calli.info, tupleTypeA, tupleTypeB, calli)
inc(c.p.nestedLoopCounter)
if tupleTypeA.kind == tyTuple: