hopefully easier to understand error message (#21585)

This commit is contained in:
Andreas Rumpf
2023-03-30 15:35:00 +02:00
committed by GitHub
parent ecf9efa397
commit 72ca444122
2 changed files with 4 additions and 4 deletions

View File

@@ -132,7 +132,7 @@ proc pickBestCandidate(c: PContext, headSymbol: PNode,
# just in case, should be impossible though
if syms.len == 0:
break
if nextSymIndex > high(syms):
# we have reached the end
break
@@ -293,7 +293,7 @@ proc presentFailedCandidates(c: PContext, n: PNode, errors: CandidateErrors):
const
errTypeMismatch = "type mismatch: got <"
errButExpected = "but expected one of:"
errExpectedPosition = "Expected one of (first mismatch at position [#]):"
errExpectedPosition = "Expected one of (first mismatch at [position]):"
errUndeclaredField = "undeclared field: '$1'"
errUndeclaredRoutine = "attempting to call undeclared routine: '$1'"
errBadRoutine = "attempting to call routine: '$1'$2"

View File

@@ -7,7 +7,7 @@ Expression: int(inNanoseconds(t2 - t1)) / 100.5
[1] int(inNanoseconds(t2 - t1)): int
[2] 100.5: float64
Expected one of (first mismatch at position [#]):
Expected one of (first mismatch at [position]):
[1] proc `/`(x, y: float): float
[1] proc `/`(x, y: float32): float32
[2] proc `/`(x, y: int): float
@@ -20,4 +20,4 @@ from times import inNanoseconds
let t1 = getMonotime()
let result = 1 + 2
let t2 = getMonotime()
echo "Elapsed: ", (t2 - t1).inNanoseconds.int / 100.5
echo "Elapsed: ", (t2 - t1).inNanoseconds.int / 100.5