improve error message when using toTask with a call with a return value (#20622)
This commit is contained in:
parent
fa1606c6d6
commit
c75cfb363f
1 changed files with 2 additions and 1 deletions
|
|
@ -110,7 +110,8 @@ macro toTask*(e: typed{nkCall | nkInfix | nkPrefix | nkPostfix | nkCommand | nkC
|
||||||
let b = toTask hello(13)
|
let b = toTask hello(13)
|
||||||
assert b is Task
|
assert b is Task
|
||||||
|
|
||||||
doAssert getTypeInst(e).typeKind == ntyVoid
|
if getTypeInst(e).typeKind != ntyVoid:
|
||||||
|
error("'toTask' cannot accept a call with a return value", e)
|
||||||
|
|
||||||
when compileOption("threads"):
|
when compileOption("threads"):
|
||||||
if not isGcSafe(e[0]):
|
if not isGcSafe(e[0]):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue