mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 19:52:36 +00:00
improve error message when using toTask with a call with a return value (#20622)
This commit is contained in:
@@ -110,7 +110,8 @@ macro toTask*(e: typed{nkCall | nkInfix | nkPrefix | nkPostfix | nkCommand | nkC
|
||||
let b = toTask hello(13)
|
||||
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"):
|
||||
if not isGcSafe(e[0]):
|
||||
|
||||
Reference in New Issue
Block a user