diff --git a/compiler/sem.nim b/compiler/sem.nim index f90d9e1f9c3c4..0fec8b7e3fc88 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -96,7 +96,7 @@ proc fitNode(c: PContext, formal: PType, arg: PNode; info: TLineInfo): PNode = else: result = indexTypesMatch(c, formal, arg.typ, arg) if result == nil: - typeMismatch(c.config, info, formal, arg.typ) + typeMismatch(c.config, info, formal, arg.typ, arg) # error correction: result = copyTree(arg) result.typ = formal diff --git a/compiler/semcall.nim b/compiler/semcall.nim index 70a7e099ca62c..1e8da02988920 100644 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -476,7 +476,7 @@ proc inferWithMetatype(c: PContext, formal: PType, result.typ = generateTypeInstance(c, m.bindings, arg.info, formal.skipTypes({tyCompositeTypeClass})) else: - typeMismatch(c.config, arg.info, formal, arg.typ) + typeMismatch(c.config, arg.info, formal, arg.typ, arg) # error correction: result = copyTree(arg) result.typ = formal diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 608a82715e50f..4cf89220acd4e 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -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])) diff --git a/compiler/semfields.nim b/compiler/semfields.nim index d7563e33fef2e..684f785ee2e4c 100644 --- a/compiler/semfields.nim +++ b/compiler/semfields.nim @@ -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.." % actualStr + msg.add " got '$1' for '$2'" % [actualStr, n.renderTree] if verbose: msg.addDeclaredLoc(conf, actual) msg.add "\n"