Merge pull request #11132 from jrfondren/expand-amb-identifier-output

provide more useful ambiguous-identifier error output
This commit is contained in:
Andreas Rumpf 2019-05-08 17:54:53 +02:00 • committed by GitHub
commit 99ae911391
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View file

@ -255,9 +255,10 @@ proc errorUseQualifier*(c: PContext; info: TLineInfo; s: PSym) =
var candidate = initIdentIter(ti, c.importTable.symbols, s.name) var candidate = initIdentIter(ti, c.importTable.symbols, s.name)
var i = 0 var i = 0
while candidate != nil: while candidate != nil:
if i == 0: err.add " -- use " if i == 0: err.add " -- use one of the following:\n"
else: err.add " or " else: err.add "\n"
err.add candidate.owner.name.s & "." & candidate.name.s err.add " " & candidate.owner.name.s & "." & candidate.name.s
err.add ": " & typeToString(candidate.typ)
candidate = nextIdentIter(ti, c.importTable.symbols) candidate = nextIdentIter(ti, c.importTable.symbols)
inc i inc i
localError(c.config, info, errGenerated, err) localError(c.config, info, errGenerated, err)

View file

@ -1,6 +1,6 @@
discard """ discard """
errormsg: "ambiguous identifier: 'range' -- use system.range or mrange.range" errormsg: "ambiguous identifier: 'range' -- use one of the following:"
line: 13 line: "13"
""" """
import mrange import mrange