replace doAssert false with raiseAssert in lib, which works better with strictdefs (#22458)

This commit is contained in:
ringabout
2023-08-12 00:24:46 +08:00
committed by GitHub
parent 48da472dd2
commit 3f7e1d7daa
22 changed files with 34 additions and 34 deletions

View File

@@ -95,7 +95,7 @@ macro getDiscriminants(a: typedesc): seq[string] =
result = quote do:
seq[string].default
else:
doAssert false, "unexpected kind: " & $t2.kind
raiseAssert "unexpected kind: " & $t2.kind
macro initCaseObject(T: typedesc, fun: untyped): untyped =
## does the minimum to construct a valid case object, only initializing
@@ -109,7 +109,7 @@ macro initCaseObject(T: typedesc, fun: untyped): untyped =
case t.kind
of nnkObjectTy: t2 = t[2]
of nnkRefTy: t2 = t[0].getTypeImpl[2]
else: doAssert false, $t.kind # xxx `nnkPtrTy` could be handled too
else: raiseAssert $t.kind # xxx `nnkPtrTy` could be handled too
doAssert t2.kind == nnkRecList
result = newTree(nnkObjConstr)
result.add sym
@@ -289,7 +289,7 @@ proc fromJson*[T](a: var T, b: JsonNode, opt = Joptions()) =
i.inc
else:
# checkJson not appropriate here
static: doAssert false, "not yet implemented: " & $T
static: raiseAssert "not yet implemented: " & $T
proc jsonTo*(b: JsonNode, T: typedesc, opt = Joptions()): T =
## reverse of `toJson`