improve the error messages for bug #6692
This commit is contained in:
parent
742f43e572
commit
3bd6b7ddc7
2 changed files with 7 additions and 6 deletions
|
|
@ -61,7 +61,7 @@ type
|
||||||
errBaseTypeMustBeOrdinal, errInheritanceOnlyWithNonFinalObjects,
|
errBaseTypeMustBeOrdinal, errInheritanceOnlyWithNonFinalObjects,
|
||||||
errInheritanceOnlyWithEnums, errIllegalRecursionInTypeX,
|
errInheritanceOnlyWithEnums, errIllegalRecursionInTypeX,
|
||||||
errCannotInstantiateX, errExprHasNoAddress, errXStackEscape,
|
errCannotInstantiateX, errExprHasNoAddress, errXStackEscape,
|
||||||
errVarForOutParamNeeded,
|
errVarForOutParamNeededX,
|
||||||
errPureTypeMismatch, errTypeMismatch, errButExpected, errButExpectedX,
|
errPureTypeMismatch, errTypeMismatch, errButExpected, errButExpectedX,
|
||||||
errAmbiguousCallXYZ, errWrongNumberOfArguments,
|
errAmbiguousCallXYZ, errWrongNumberOfArguments,
|
||||||
errWrongNumberOfArgumentsInCall,
|
errWrongNumberOfArgumentsInCall,
|
||||||
|
|
@ -268,7 +268,7 @@ const
|
||||||
errCannotInstantiateX: "cannot instantiate: \'$1\'",
|
errCannotInstantiateX: "cannot instantiate: \'$1\'",
|
||||||
errExprHasNoAddress: "expression has no address",
|
errExprHasNoAddress: "expression has no address",
|
||||||
errXStackEscape: "address of '$1' may not escape its stack frame",
|
errXStackEscape: "address of '$1' may not escape its stack frame",
|
||||||
errVarForOutParamNeeded: "for a \'var\' type a variable needs to be passed",
|
errVarForOutParamNeededX: "for a \'var\' type a variable needs to be passed; but '$1' is immutable",
|
||||||
errPureTypeMismatch: "type mismatch",
|
errPureTypeMismatch: "type mismatch",
|
||||||
errTypeMismatch: "type mismatch: got (",
|
errTypeMismatch: "type mismatch: got (",
|
||||||
errButExpected: "but expected one of: ",
|
errButExpected: "but expected one of: ",
|
||||||
|
|
|
||||||
|
|
@ -465,7 +465,7 @@ proc newHiddenAddrTaken(c: PContext, n: PNode): PNode =
|
||||||
result = newNodeIT(nkHiddenAddr, n.info, makeVarType(c, n.typ))
|
result = newNodeIT(nkHiddenAddr, n.info, makeVarType(c, n.typ))
|
||||||
addSon(result, n)
|
addSon(result, n)
|
||||||
if isAssignable(c, n) notin {arLValue, arLocalLValue}:
|
if isAssignable(c, n) notin {arLValue, arLocalLValue}:
|
||||||
localError(n.info, errVarForOutParamNeeded)
|
localError(n.info, errVarForOutParamNeededX, $n)
|
||||||
|
|
||||||
proc analyseIfAddressTaken(c: PContext, n: PNode): PNode =
|
proc analyseIfAddressTaken(c: PContext, n: PNode): PNode =
|
||||||
result = n
|
result = n
|
||||||
|
|
@ -509,9 +509,10 @@ proc analyseIfAddressTakenInCall(c: PContext, n: PNode) =
|
||||||
for i in countup(1, sonsLen(n) - 1):
|
for i in countup(1, sonsLen(n) - 1):
|
||||||
if i < sonsLen(t) and t.sons[i] != nil and
|
if i < sonsLen(t) and t.sons[i] != nil and
|
||||||
skipTypes(t.sons[i], abstractInst-{tyTypeDesc}).kind == tyVar:
|
skipTypes(t.sons[i], abstractInst-{tyTypeDesc}).kind == tyVar:
|
||||||
if isAssignable(c, n.sons[i]) notin {arLValue, arLocalLValue}:
|
let it = n[i]
|
||||||
if n.sons[i].kind != nkHiddenAddr:
|
if isAssignable(c, it) notin {arLValue, arLocalLValue}:
|
||||||
localError(n.sons[i].info, errVarForOutParamNeeded)
|
if it.kind != nkHiddenAddr:
|
||||||
|
localError(it.info, errVarForOutParamNeededX, $it)
|
||||||
return
|
return
|
||||||
for i in countup(1, sonsLen(n) - 1):
|
for i in countup(1, sonsLen(n) - 1):
|
||||||
if n.sons[i].kind == nkHiddenCallConv:
|
if n.sons[i].kind == nkHiddenCallConv:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue