diff --git a/stew.nimble b/stew.nimble index 1651e93..fa03cd4 100644 --- a/stew.nimble +++ b/stew.nimble @@ -12,31 +12,17 @@ requires "nim >= 1.2.0", ### Helper functions proc test(args, path: string) = - # nnkArglist was changed to nnkArgList, so can't always use --styleCheck:error - # https://github.com/nim-lang/Nim/pull/17529 - # https://github.com/nim-lang/Nim/pull/19822 - let styleCheckStyle = - if (NimMajor, NimMinor) < (1, 6): - "hint" - else: - "error" - # Compilation language is controlled by TEST_LANG exec "nim " & getEnv("TEST_LANG", "c") & " " & getEnv("NIMFLAGS") & " " & args & - " -r --hints:off --skipParentCfg --styleCheck:usages --styleCheck:" & - styleCheckStyle & " " & path + " -r --hints:off --skipParentCfg --styleCheck:usages --styleCheck:error" & + " " & path proc buildHelper(args, path: string) = - let styleCheckStyle = - if (NimMajor, NimMinor) < (1, 6): - "hint" - else: - "error" exec "nim " & getEnv("TEST_LANG", "c") & " " & getEnv("NIMFLAGS") & " " & args & - " --hints:off --skipParentCfg --styleCheck:usages --styleCheck:" & - styleCheckStyle & " " & path + " --hints:off --skipParentCfg --styleCheck:usages --styleCheck:error" & + " " & path task test, "Run all tests": # Building `test_helper.nim`. diff --git a/stew/shims/macros.nim b/stew/shims/macros.nim index 828b3df..e6e014f 100644 --- a/stew/shims/macros.nim +++ b/stew/shims/macros.nim @@ -414,11 +414,19 @@ iterator baseTypes*(exceptionType: NimNode): NimNode = yield typ macro unpackArgs*(callee: untyped, args: untyped): untyped = + # nnkArglist was changed to nnkArgList + # https://github.com/nim-lang/Nim/pull/17529 + # https://github.com/nim-lang/Nim/pull/19822 + const ArgKind = when (NimMajor, NimMinor) < (1, 6): + nnkArglist + else: + nnkArgList + result = newCall(callee) for arg in args: let arg = if arg.kind == nnkHiddenStdConv: arg[1] else: arg - if arg.kind == nnkArgList: + if arg.kind == ArgKind: for subarg in arg: result.add subarg else: