diff --git a/lib/core/macros.nim b/lib/core/macros.nim index 9b82e658c8..f838a0fc74 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -976,6 +976,8 @@ proc newIfStmt*(branches: varargs[tuple[cond, body: NimNode]]): ## ) ## result = newNimNode(nnkIfStmt) + if len(branches) < 1: + error("If statement must have at least one branch") for i in branches: result.add(newTree(nnkElifBranch, i.cond, i.body))