From 171f4a21e8b2180cfeb4dcdb0ebde95f73b3dec3 Mon Sep 17 00:00:00 2001 From: EXetoC Date: Sun, 20 Apr 2014 23:03:31 +0200 Subject: [PATCH 1/2] Fix spawn ICE on invalid argument. --- compiler/semfold.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/semfold.nim b/compiler/semfold.nim index caaab22912..79abfaf4dd 100644 --- a/compiler/semfold.nim +++ b/compiler/semfold.nim @@ -404,7 +404,7 @@ proc evalOp(m: TMagic, n, a, b, c: PNode): PNode = mExit, mInc, ast.mDec, mEcho, mSwap, mAppendStrCh, mAppendStrStr, mAppendSeqElem, mSetLengthStr, mSetLengthSeq, mParseExprToAst, mParseStmtToAst, mExpandToAst, mTypeTrait, - mNLen..mNError, mEqRef, mSlurp, mStaticExec, mNGenSym: + mNLen..mNError, mEqRef, mSlurp, mStaticExec, mNGenSym, mSpawn: discard of mRand: result = newIntNodeT(math.random(a.getInt.int), n) From d29cf2d0e2390e1642b0bd755e506826c1578252 Mon Sep 17 00:00:00 2001 From: EXetoC Date: Sun, 20 Apr 2014 23:09:29 +0200 Subject: [PATCH 2/2] Add test for bad spawn argument. --- tests/system/tsysspawnbadarg.nim | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tests/system/tsysspawnbadarg.nim diff --git a/tests/system/tsysspawnbadarg.nim b/tests/system/tsysspawnbadarg.nim new file mode 100644 index 0000000000..ace074602c --- /dev/null +++ b/tests/system/tsysspawnbadarg.nim @@ -0,0 +1,7 @@ +discard """ + line: 7 + errormsg: "'spawn' takes a call expression of type void" + cmd: "nimrod $target --threads:on $options $file" +""" + +spawn(1)