From 7a48942719f4a557abafefd6d5cbd8b25a283e3a Mon Sep 17 00:00:00 2001 From: Araq Date: Sun, 26 Oct 2014 19:54:43 +0100 Subject: nicer error messages (untested) --- compiler/sigmatch.nim | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'compiler/sigmatch.nim') diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index b5e01811e..4a3773ed8 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -22,6 +22,7 @@ type TCandidateState* = enum csEmpty, csMatch, csNoMatch + CandidateErrors* = seq[PSym] TCandidate* {.final.} = object c*: PContext exactMatches*: int # also misused to prefer iters over procs @@ -45,7 +46,7 @@ type # a distrinct type typedescMatched: bool inheritancePenalty: int # to prefer closest father object type - errors*: seq[string] # additional clarifications to be displayed to the + errors*: CandidateErrors # additional clarifications to be displayed to the # user if overload resolution fails TTypeRelation* = enum # order is important! @@ -202,16 +203,17 @@ proc writeMatches*(c: TCandidate) = writeln(stdout, "intconv matches: " & $c.intConvMatches) writeln(stdout, "generic matches: " & $c.genericMatches) -proc argTypeToString(arg: PNode): string = +proc argTypeToString(arg: PNode; prefer: TPreferedDesc): string = if arg.kind in nkSymChoices: - result = typeToString(arg[0].typ) + result = typeToString(arg[0].typ, prefer) for i in 1 ..