Skip to content

Commit

Permalink
fix nim-lang#13538 sigmatch now sorted and has reliable order
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Mar 20, 2020
1 parent 35fb386 commit ac6a368
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions compiler/semcall.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
## This module implements semantic checking for calls.
# included from sem.nim

from algorithm import sort

proc sameMethodDispatcher(a, b: PSym): bool =
result = false
if a.kind == skMethod and b.kind == skMethod:
Expand Down Expand Up @@ -178,9 +180,11 @@ proc presentFailedCandidates(c: PContext, n: PNode, errors: CandidateErrors):

var maybeWrongSpace = false

var candidatesAll: seq[string]
var candidates = ""
var skipped = 0
for err in errors:
candidates.setLen 0
if filterOnlyFirst and err.firstMismatch.arg == 1:
inc skipped
continue
Expand Down Expand Up @@ -225,6 +229,9 @@ proc presentFailedCandidates(c: PContext, n: PNode, errors: CandidateErrors):
maybeWrongSpace = true
for diag in err.diagnostics:
candidates.add(diag & "\n")
candidatesAll.add candidates
candidatesAll.sort # fix #13538
candidates = join(candidatesAll)
if skipped > 0:
candidates.add($skipped & " other mismatching symbols have been " &
"suppressed; compile with --showAllMismatches:on to see them\n")
Expand Down

0 comments on commit ac6a368

Please sign in to comment.