* improve error message * use single % operation
This commit is contained in:
parent
afc453beff
commit
e8cf289bee
1 changed files with 3 additions and 2 deletions
|
|
@ -277,8 +277,9 @@ proc freshVarForClosureIter*(g: ModuleGraph; s, owner: PSym): PNode =
|
||||||
proc markAsClosure(g: ModuleGraph; owner: PSym; n: PNode) =
|
proc markAsClosure(g: ModuleGraph; owner: PSym; n: PNode) =
|
||||||
let s = n.sym
|
let s = n.sym
|
||||||
if illegalCapture(s):
|
if illegalCapture(s):
|
||||||
localError(g.config, n.info, "illegal capture '$1' of type <$2> which is declared here: $3" %
|
localError(g.config, n.info,
|
||||||
[s.name.s, typeToString(s.typ), g.config$s.info])
|
("'$1' is of type <$2> which cannot be captured as it would violate memory" &
|
||||||
|
" safety, declared here: $3") % [s.name.s, typeToString(s.typ), g.config$s.info])
|
||||||
elif owner.typ.callConv notin {ccClosure, ccDefault}:
|
elif owner.typ.callConv notin {ccClosure, ccDefault}:
|
||||||
localError(g.config, n.info, "illegal capture '$1' because '$2' has the calling convention: <$3>" %
|
localError(g.config, n.info, "illegal capture '$1' because '$2' has the calling convention: <$3>" %
|
||||||
[s.name.s, owner.name.s, CallingConvToStr[owner.typ.callConv]])
|
[s.name.s, owner.name.s, CallingConvToStr[owner.typ.callConv]])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue