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

@@ -60,7 +60,7 @@ proc nativeToUnixPath*(path: string): string =
result[0] = '/'
result[1] = path[0]
if path.len > 2 and path[2] != '\\':
doAssert false, "paths like `C:foo` are currently unsupported, path: " & path
raiseAssert "paths like `C:foo` are currently unsupported, path: " & path
when DirSep == '\\':
result = replace(result, '\\', '/')

View File

@@ -396,7 +396,7 @@ proc moveFile*(source, dest: string) {.rtl, extern: "nos$1",
if not tryMoveFSObject(source, dest, isDir = false):
when defined(windows):
doAssert false
raiseAssert "unreachable"
else:
# Fallback to copy & del
copyFile(source, dest, {cfSymlinkAsIs})

View File

@@ -259,7 +259,7 @@ proc isAbsolute*(path: string): bool {.rtl, noSideEffect, extern: "nos$1", raise
# This works around the problem for posix, but Windows is still broken with nim js -d:nodejs
result = path[0] == '/'
else:
doAssert false # if ever hits here, adapt as needed
raiseAssert "unreachable" # if ever hits here, adapt as needed
when FileSystemCaseSensitive:
template `!=?`(a, b: char): bool = a != b
@@ -859,7 +859,7 @@ when not defined(nimscript):
{.emit: "`ret` = process.cwd();".}
return $ret
elif defined(js):
doAssert false, "use -d:nodejs to have `getCurrentDir` defined"
raiseAssert "use -d:nodejs to have `getCurrentDir` defined"
elif defined(windows):
var bufsize = MAX_PATH.int32
var res = newWideCString("", bufsize)