diff options
35 files changed, 111 insertions, 178 deletions
diff --git a/compiler/condsyms.nim b/compiler/condsyms.nim index 8e0e2f300..3d14408a3 100644 --- a/compiler/condsyms.nim +++ b/compiler/condsyms.nim @@ -47,8 +47,7 @@ proc initDefines*(symbols: StringTableRef) = defineSymbol("nimparsebiggestfloatmagic") # deadcode defineSymbol("nimalias") # deadcode defineSymbol("nimlocks") # deadcode - defineSymbol("nimnode") # deadcode pending `nimnode` reference in opengl package - # refs https://github.com/nim-lang/opengl/pull/79 + defineSymbol("nimnode") # deadcode defineSymbol("nimvarargstyped") # deadcode defineSymbol("nimtypedescfixed") # deadcode defineSymbol("nimKnowsNimvm") # deadcode diff --git a/compiler/nim.nim b/compiler/nim.nim index 420579b97..b28e8b20c 100644 --- a/compiler/nim.nim +++ b/compiler/nim.nim @@ -12,10 +12,7 @@ import std/[os, strutils, parseopt] when defined(nimPreviewSlimSystem): import std/assertions -when defined(windows) and not defined(nimKochBootstrap): - # remove workaround pending bootstrap >= 1.5.1 - # refs https://github.com/nim-lang/Nim/issues/18334#issuecomment-867114536 - # alternative would be to prepend `currentSourcePath.parentDir.quoteShell` +when defined(windows): when defined(gcc): when defined(x86): {.link: "../icons/nim.res".} diff --git a/compiler/options.nim b/compiler/options.nim index c0b99744c..e78dd72f2 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -867,14 +867,6 @@ template patchModule(conf: ConfigRef) {.dirty.} = let ov = conf.moduleOverrides[key] if ov.len > 0: result = AbsoluteFile(ov) -when (NimMajor, NimMinor) < (1, 1) or not declared(isRelativeTo): - proc isRelativeTo(path, base: string): bool = - # pending #13212 use os.isRelativeTo - let path = path.normalizedPath - let base = base.normalizedPath - let ret = relativePath(path, base) - result = path.len > 0 and not ret.startsWith ".." - const stdlibDirs* = [ "pure", "core", "arch", "pure/collections", diff --git a/compiler/renderer.nim b/compiler/renderer.nim index ea5446cb1..f0ad21815 100644 --- a/compiler/renderer.nim +++ b/compiler/renderer.nim @@ -1380,15 +1380,9 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext, fromStmtList = false) = of nkAccQuoted: put(g, tkAccent, "`") for i in 0..<n.len: - proc getStrVal(n: PNode): string = - # pending https://github.com/nim-lang/Nim/pull/17540, use `getStrVal` - case n.kind - of nkIdent: n.ident.s - of nkSym: n.sym.name.s - else: "" proc isAlpha(n: PNode): bool = if n.kind in {nkIdent, nkSym}: - let tmp = n.getStrVal + let tmp = n.getPIdent.s result = tmp.len > 0 and tmp[0] in {'a'..'z', 'A'..'Z'} var useSpace = false if i == 1 and n[0].kind == nkIdent and n[0].ident.s in ["=", "'"]: diff --git a/config/config.nims b/config/config.nims index 4f3e2b13f..5c9c88e8a 100644 --- a/config/config.nims +++ b/config/config.nims @@ -11,7 +11,7 @@ cppDefine "NAN" when defined(nimStrictMode): # xxx add more flags here, and use `-d:nimStrictMode` in more contexts in CI. - # pending bug #14246, enable this: + # enable this: # when defined(nimHasWarningAsError): # switch("warningAsError", "UnusedImport") diff --git a/lib/pure/os.nim b/lib/pure/os.nim index 0569e6cab..e9408f826 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -1016,10 +1016,8 @@ func isValidFilename*(filename: string, maxLen = 259.Positive): bool {.since: (1 # deprecated declarations -when not defined(nimscript): - when not defined(js): # `noNimJs` doesn't work with templates, this should improve. - template existsFile*(args: varargs[untyped]): untyped {.deprecated: "use fileExists".} = - fileExists(args) - template existsDir*(args: varargs[untyped]): untyped {.deprecated: "use dirExists".} = - dirExists(args) - # {.deprecated: [existsFile: fileExists].} # pending bug #14819; this would avoid above mentioned issue +when not weirdTarget: + template existsFile*(args: varargs[untyped]): untyped {.deprecated: "use fileExists".} = + fileExists(args) + template existsDir*(args: varargs[untyped]): untyped {.deprecated: "use dirExists".} = + dirExists(args) diff --git a/lib/std/exitprocs.nim b/lib/std/exitprocs.nim index 36f22a5d1..736bf06d1 100644 --- a/lib/std/exitprocs.nim +++ b/lib/std/exitprocs.nim @@ -81,7 +81,6 @@ when not defined(nimscript): doAssert false proc setProgramResult*(a: int) = - # pending https://github.com/nim-lang/Nim/issues/14674 when defined(js) and defined(nodejs): asm """ process.exitCode = `a`; diff --git a/lib/std/jsbigints.nim b/lib/std/jsbigints.nim index fda299e7b..067de78b5 100644 --- a/lib/std/jsbigints.nim +++ b/lib/std/jsbigints.nim @@ -110,7 +110,7 @@ func `==`*(x, y: JsBigInt): bool {.importjs: "(# == #)".} = doAssert big"42" == big"42" func `**`*(x, y: JsBigInt): JsBigInt {.importjs: "((#) $1 #)".} = - # (#) needed, refs https://github.com/nim-lang/Nim/pull/16409#issuecomment-760550812 + # (#) needed due to unary minus runnableExamples: doAssert big"2" ** big"64" == big"18446744073709551616" doAssert big"-2" ** big"3" == big"-8" @@ -120,8 +120,6 @@ func `**`*(x, y: JsBigInt): JsBigInt {.importjs: "((#) $1 #)".} = try: discard big"2" ** big"-1" # raises foreign `RangeError` except: ok = true doAssert ok - # pending https://github.com/nim-lang/Nim/pull/15940, simplify to: - # doAssertRaises: discard big"2" ** big"-1" # raises foreign `RangeError` func `and`*(x, y: JsBigInt): JsBigInt {.importjs: "(# & #)".} = runnableExamples: diff --git a/lib/std/jsonutils.nim b/lib/std/jsonutils.nim index f17407f20..847761e2f 100644 --- a/lib/std/jsonutils.nim +++ b/lib/std/jsonutils.nim @@ -371,7 +371,6 @@ proc toJsonHook*[K: string|cstring, V](t: (Table[K, V] | OrderedTable[K, V]), op ## ## See also: ## * `fromJsonHook proc<#fromJsonHook,,JsonNode>`_ - # pending PR #9217 use: toSeq(a) instead of `collect` in `runnableExamples`. runnableExamples: import std/[tables, json, sugar] let foo = ( diff --git a/lib/std/private/osfiles.nim b/lib/std/private/osfiles.nim index 7f822ffcc..78afd35da 100644 --- a/lib/std/private/osfiles.nim +++ b/lib/std/private/osfiles.nim @@ -155,10 +155,14 @@ when hasCCopyfile: proc copyfile_state_alloc(): copyfile_state_t proc copyfile_state_free(state: copyfile_state_t): cint proc c_copyfile(src, dst: cstring, state: copyfile_state_t, flags: copyfile_flags_t): cint {.importc: "copyfile".} - # replace with `let` pending bootstrap >= 1.4.0 - var - COPYFILE_DATA {.nodecl.}: copyfile_flags_t - COPYFILE_XATTR {.nodecl.}: copyfile_flags_t + when (NimMajor, NimMinor) >= (1, 4): + let + COPYFILE_DATA {.nodecl.}: copyfile_flags_t + COPYFILE_XATTR {.nodecl.}: copyfile_flags_t + else: + var + COPYFILE_DATA {.nodecl.}: copyfile_flags_t + COPYFILE_XATTR {.nodecl.}: copyfile_flags_t {.pop.} type diff --git a/lib/std/strbasics.nim b/lib/std/strbasics.nim index be1dd7a58..b2c36a4be 100644 --- a/lib/std/strbasics.nim +++ b/lib/std/strbasics.nim @@ -23,8 +23,8 @@ proc add*(x: var string, y: openArray[char]) = # Use `{.noalias.}` ? let n = x.len x.setLen n + y.len - # pending https://github.com/nim-lang/Nim/issues/14655#issuecomment-643671397 - # use x.setLen(n + y.len, isInit = false) + # pending #19727 + # setLen unnecessarily zeros memory var i = 0 while i < y.len: x[n + i] = y[i] diff --git a/lib/std/sysrand.nim b/lib/std/sysrand.nim index d57f2845e..7943f2e1b 100644 --- a/lib/std/sysrand.nim +++ b/lib/std/sysrand.nim @@ -168,8 +168,10 @@ elif defined(windows): result = randomBytes(addr dest[0], size) elif defined(linux) and not defined(nimNoGetRandom) and not defined(emscripten): - # TODO using let, pending bootstrap >= 1.4.0 - var SYS_getrandom {.importc: "SYS_getrandom", header: "<sys/syscall.h>".}: clong + when (NimMajor, NimMinor) >= (1, 4): + let SYS_getrandom {.importc: "SYS_getrandom", header: "<sys/syscall.h>".}: clong + else: + var SYS_getrandom {.importc: "SYS_getrandom", header: "<sys/syscall.h>".}: clong const syscallHeader = """#include <unistd.h> #include <sys/syscall.h>""" diff --git a/testament/important_packages.nim b/testament/important_packages.nim index c77acd99b..7e030e92c 100644 --- a/testament/important_packages.nim +++ b/testament/important_packages.nim @@ -43,7 +43,7 @@ pkg "awk" pkg "bigints" pkg "binaryheap", "nim c -r binaryheap.nim" pkg "BipBuffer" -pkg "blscurve", allowFailure = true # pending https://github.com/status-im/nim-blscurve/issues/39 +pkg "blscurve", allowFailure = true pkg "bncurve" pkg "brainfuck", "nim c -d:release -r tests/compile.nim" pkg "bump", "nim c --gc:arc --path:. -r tests/tbump.nim", "https://github.com/disruptek/bump", allowFailure = true @@ -58,7 +58,7 @@ pkg "cligen", "nim c --path:. -r cligen.nim" pkg "combparser", "nimble test --gc:orc" pkg "compactdict" pkg "comprehension", "nimble test", "https://github.com/alehander92/comprehension" -pkg "criterion", allowFailure = true # pending https://github.com/disruptek/criterion/issues/3 (wrongly closed) +pkg "criterion", allowFailure = true # needs testing binary pkg "datamancer" pkg "dashing", "nim c tests/functional.nim" pkg "delaunay" @@ -104,7 +104,6 @@ pkg "NimData", "nim c -o:nimdataa src/nimdata.nim" pkg "nimes", "nim c src/nimes.nim" pkg "nimfp", "nim c -o:nfp -r src/fp.nim" pkg "nimgame2", "nim c --mm:refc nimgame2/nimgame.nim" - # XXX Doesn't work with deprecated 'randomize', will create a PR. pkg "nimgen", "nim c -o:nimgenn -r src/nimgen/runcfg.nim" pkg "nimib" pkg "nimlsp" diff --git a/tests/errmsgs/t8794.nim b/tests/errmsgs/t8794.nim index 9db54a9c7..36f05dbad 100644 --- a/tests/errmsgs/t8794.nim +++ b/tests/errmsgs/t8794.nim @@ -1,33 +1,16 @@ discard """ cmd: "nim check $options $file" - errormsg: "" - nimout: ''' -t8794.nim(39, 27) Error: undeclared field: 'a3' for type m8794.Foo3 [type declared in m8794.nim(1, 6)] -''' """ - - - - - - - - - - - -## line 20 - ## issue #8794 import m8794 -when false: # pending https://github.com/nim-lang/Nim/pull/10091 add this - type Foo = object - a1: int +type Foo = object + a1: int - discard Foo().a2 +discard Foo().a2 #[tt.Error + ^ undeclared field: 'a2' for type t8794.Foo [type declared in t8794.nim(9, 6)]]# type Foo3b = Foo3 var x2: Foo3b @@ -36,4 +19,5 @@ proc getFun[T](): T = var a: T a -discard getFun[type(x2)]().a3 +discard getFun[type(x2)]().a3 #[tt.Error + ^ undeclared field: 'a3' for type m8794.Foo3 [type declared in m8794.nim(1, 6)]]# diff --git a/tests/exception/t13115.nim b/tests/exception/t13115.nim index ee1daed26..5db8f9107 100644 --- a/tests/exception/t13115.nim +++ b/tests/exception/t13115.nim @@ -13,13 +13,6 @@ else: const nim = getCurrentCompilerExe() const file = currentSourcePath for b in "c js cpp".split: - when defined(openbsd): - if b == "js": - # xxx bug: pending #13115 - # remove special case once nodejs updated >= 12.16.2 - # refs https://github.com/nim-lang/Nim/pull/16167#issuecomment-738270751 - continue - # save CI time by avoiding mostly redundant combinations as far as this bug is concerned var opts = case b of "c": @["", "-d:nim_t13115_static", "-d:danger", "-d:debug"] diff --git a/tests/float/tfloats.nim b/tests/float/tfloats.nim index 480396e81..967605c53 100644 --- a/tests/float/tfloats.nim +++ b/tests/float/tfloats.nim @@ -41,8 +41,7 @@ template main = test ".1", 0.1 test "-.1", -0.1 test "-0", -0.0 - when false: # pending bug #18246 - test "-0", -0.0 + test "-0", -0'f # see #18246, -0 won't work test ".1e-1", 0.1e-1 test "0_1_2_3.0_1_2_3E+0_1_2", 123.0123e12 test "0_1_2.e-0", 12e0 diff --git a/tests/importalls/m4.nim b/tests/importalls/m4.nim index b682b766a..77ec65c61 100644 --- a/tests/importalls/m4.nim +++ b/tests/importalls/m4.nim @@ -1,4 +1,3 @@ -{.warning[UnusedImport]: off.} # xxx bug: this shouldn't be needed since we have `export m3` import ./m3 {.all.} import ./m3 as m3b export m3b diff --git a/tests/lent/tbasic_lent_check.nim b/tests/lent/tbasic_lent_check.nim index 92d731451..ce9b89adf 100644 --- a/tests/lent/tbasic_lent_check.nim +++ b/tests/lent/tbasic_lent_check.nim @@ -28,7 +28,7 @@ template main2 = # bug #15958 doAssert byLent(a) == [11,12] doAssert sameAddress(byLent(a), a) doAssert byLent(b) == @[21,23] - # pending bug #16073 + # bug #16073 doAssert sameAddress(byLent(b), b) doAssert byLent(ss) == {1, 2, 3, 5} doAssert sameAddress(byLent(ss), ss) diff --git a/tests/macros/ttemplatesymbols.nim b/tests/macros/ttemplatesymbols.nim index 280b34ff1..3182de79d 100644 --- a/tests/macros/ttemplatesymbols.nim +++ b/tests/macros/ttemplatesymbols.nim @@ -148,8 +148,6 @@ proc overloadedProc[T](x: T) = echo x """ - # XXX: There seems to be a repr rendering problem above. - # Notice that `echo [x]` inspectSymbol overloadedProc[float], """ proc overloadedProc(x: T) = diff --git a/tests/metatype/tcompositetypeclasses.nim b/tests/metatype/tcompositetypeclasses.nim index d125b119b..43b6a57e4 100644 --- a/tests/metatype/tcompositetypeclasses.nim +++ b/tests/metatype/tcompositetypeclasses.nim @@ -30,7 +30,7 @@ accept bar(vbar) accept baz(vbar) accept baz(vbaz) -#reject baz(vnotbaz) # XXX this really shouldn't compile +reject baz(vnotbaz) reject bar(vfoo) # https://github.com/Araq/Nim/issues/517 diff --git a/tests/misc/tcsharpusingstatement.nim b/tests/misc/tcsharpusingstatement.nim index dd4cf589d..1ce553895 100644 --- a/tests/misc/tcsharpusingstatement.nim +++ b/tests/misc/tcsharpusingstatement.nim @@ -49,25 +49,13 @@ macro autoClose(args: varargs[untyped]): untyped = var finallyBlock = newNimNode(nnkStmtList) finallyBlock.add(closingCalls) - # XXX: Use a template here once getAst is working properly - var targetAst = parseStmt"""block: - var - x = foo() - y = bar() - - try: - body() - - finally: - close x - close y - """ - - targetAst[0][1][0] = varSection - targetAst[0][1][1][0] = body - targetAst[0][1][1][1][0] = finallyBlock - - result = targetAst + result = quote do: + block: + `varSection` + try: + `body` + finally: + `finallyBlock` type TResource* = object diff --git a/tests/misc/tspellsuggest.nim b/tests/misc/tspellsuggest.nim index 345458bb1..ea0a98cd3 100644 --- a/tests/misc/tspellsuggest.nim +++ b/tests/misc/tspellsuggest.nim @@ -1,6 +1,5 @@ discard """ - # pending bug #16521 (bug 12) use `matrix` - cmd: "nim c --spellsuggest:15 --hints:off $file" + matrix: "--spellsuggest:15 --hints:off" action: "reject" nimout: ''' tspellsuggest.nim(45, 13) Error: undeclared identifier: 'fooBar' @@ -27,6 +26,7 @@ candidates (edit distance, scope distance); see '--spellSuggest': + # line 30 import ./mspellsuggest diff --git a/tests/misc/tspellsuggest2.nim b/tests/misc/tspellsuggest2.nim index d20fb00dc..4bf05799e 100644 --- a/tests/misc/tspellsuggest2.nim +++ b/tests/misc/tspellsuggest2.nim @@ -1,6 +1,5 @@ discard """ - # pending bug #16521 (bug 12) use `matrix` - cmd: "nim c --spellsuggest:12 --hints:off $file" + matrix: "--spellsuggest:12 --hints:off" action: "reject" nimout: ''' tspellsuggest2.nim(45, 13) Error: undeclared identifier: 'fooBar' @@ -27,6 +26,7 @@ candidates (edit distance, scope distance); see '--spellSuggest': + # line 30 import ./mspellsuggest diff --git a/tests/misc/tspellsuggest3.nim b/tests/misc/tspellsuggest3.nim index 9b0b84602..bd4d5256f 100644 --- a/tests/misc/tspellsuggest3.nim +++ b/tests/misc/tspellsuggest3.nim @@ -1,6 +1,5 @@ discard """ - # pending bug #16521 (bug 12) use `matrix` - cmd: "nim c --spellsuggest:4 --hints:off $file" + matrix: "--spellsuggest:4 --hints:off" action: "reject" nimout: ''' tspellsuggest3.nim(21, 1) Error: undeclared identifier: 'fooBar' @@ -12,6 +11,7 @@ candidates (edit distance, scope distance); see '--spellSuggest': ''' """ + import ./mspellsuggest import ./mspellsuggest import ./mspellsuggest diff --git a/tests/nimdoc/trunnableexamples.nim b/tests/nimdoc/trunnableexamples.nim index 1886ceeb3..57e725b2e 100644 --- a/tests/nimdoc/trunnableexamples.nim +++ b/tests/nimdoc/trunnableexamples.nim @@ -1,5 +1,5 @@ discard """ -cmd: "nim doc --doccmd:--hints:off --hints:off $file" +cmd: '''nim doc --doccmd:"-d:testFooExternal --hints:off" --hints:off $file''' action: "compile" nimoutFull: true nimout: ''' @@ -19,12 +19,6 @@ foo6 joinable: false """ -#[ -pending bug #18077, use instead: -cmd: "nim doc --doccmd:'-d:testFooExternal --hints:off' --hints:off $file" -and merge trunnableexamples2 back here -]# -{.define(testFooExternal).} proc fun*() = runnableExamples: @@ -212,3 +206,8 @@ snippet: doAssert defined(testFooExternal) ]## + +when true: # runnableExamples with rdoccmd + runnableExamples "-d:testFoo -d:testBar": + doAssert defined(testFoo) and defined(testBar) + doAssert defined(testFooExternal) diff --git a/tests/nimdoc/trunnableexamples2.nim b/tests/nimdoc/trunnableexamples2.nim deleted file mode 100644 index 5a437744e..000000000 --- a/tests/nimdoc/trunnableexamples2.nim +++ /dev/null @@ -1,11 +0,0 @@ -discard """ -cmd: "nim doc --doccmd:-d:testFooExternal --hints:off $file" -action: "compile" -joinable: false -""" - -# pending bug #18077, merge back inside trunnableexamples.nim -when true: # runnableExamples with rdoccmd - runnableExamples "-d:testFoo -d:testBar": - doAssert defined(testFoo) and defined(testBar) - doAssert defined(testFooExternal) diff --git a/tests/overload/tstatic_with_converter.nim b/tests/overload/tstatic_with_converter.nim index e830e8a22..2bc1dfaab 100644 --- a/tests/overload/tstatic_with_converter.nim +++ b/tests/overload/tstatic_with_converter.nim @@ -1,7 +1,6 @@ discard """ output: ''' 9.0 - ''' """ @@ -39,12 +38,11 @@ proc `^`(x: vfloat, exp: static[float]): vfloat = when exp == 0.5: sqrt(x) else: - pow(x, exp) + pow(x, exp) proc `$`(x: vfloat): string = let y = cast[ptr float](addr x) - # xxx not sure if intentional in this issue, but this returns "" - echo y[] + result = $y[] let x = set1(9.0) echo x^0.5 diff --git a/tests/parallel/tblocking_channel.nim b/tests/parallel/tblocking_channel.nim index eb5fcb715..f3ccd166a 100644 --- a/tests/parallel/tblocking_channel.nim +++ b/tests/parallel/tblocking_channel.nim @@ -1,8 +1,8 @@ discard """ output: "" -disabled: "freebsd" +disabled: "freebsd" # see #15725 """ -# disabled pending bug #15725 + import threadpool, os var chan: Channel[int] diff --git a/tests/stdlib/tdecls.nim b/tests/stdlib/tdecls.nim index c17fd3343..42dc646f2 100644 --- a/tests/stdlib/tdecls.nim +++ b/tests/stdlib/tdecls.nim @@ -14,18 +14,18 @@ template fun() = var b {.byaddr.}: int = s[0] doAssert a.addr == b.addr - when false: - # template specific redeclaration issue - # see https://github.com/nim-lang/Nim/issues/8275 - doAssert not compiles(block: - # redeclaration not allowed - var foo = 0 - var foo {.byaddr.} = s[0]) - - doAssert not compiles(block: - # ditto - var foo {.byaddr.} = s[0] - var foo {.byaddr.} = s[0]) + {.push warningAsError[ImplicitTemplateRedefinition]: on.} + # in the future ImplicitTemplateRedefinition will be an error anyway + doAssert not compiles(block: + # redeclaration not allowed + var foo = 0 + var foo {.byaddr.} = s[0]) + + doAssert not compiles(block: + # ditto + var foo {.byaddr.} = s[0] + var foo {.byaddr.} = s[0]) + {.pop.} block: var b {.byaddr.} = s[1] # redeclaration ok in sub scope diff --git a/tests/stdlib/tosproc.nim b/tests/stdlib/tosproc.nim index 1184503f5..da4f6252d 100644 --- a/tests/stdlib/tosproc.nim +++ b/tests/stdlib/tosproc.nim @@ -94,9 +94,7 @@ else: # main driver const sourcePath = currentSourcePath() let dir = getCurrentDir() / "tests" / "osproc" - template deferScoped(cleanup, body) = - # pending https://github.com/nim-lang/RFCs/issues/236#issuecomment-646855314 - # xxx move to std/sugar or (preferably) some low level module + template deferring(cleanup, body) = try: body finally: cleanup @@ -250,14 +248,14 @@ else: # main driver var x = newStringOfCap(120) block: # startProcess stdout poStdErrToStdOut (replaces old test `tstdout` + `ta_out`) var p = startProcess(output, dir, options={poStdErrToStdOut}) - deferScoped: p.close() + deferring: p.close() do: var sout: seq[string] while p.outputStream.readLine(x): sout.add x doAssert sout == @["start ta_out", "to stdout", "to stdout", "to stderr", "to stderr", "to stdout", "to stdout", "end ta_out"] block: # startProcess stderr (replaces old test `tstderr` + `ta_out`) var p = startProcess(output, dir, options={}) - deferScoped: p.close() + deferring: p.close() do: var serr, sout: seq[string] while p.errorStream.readLine(x): serr.add x diff --git a/tests/stdlib/trandom.nim b/tests/stdlib/trandom.nim index 4104ad1a4..8784b33ee 100644 --- a/tests/stdlib/trandom.nim +++ b/tests/stdlib/trandom.nim @@ -192,9 +192,7 @@ block: # bug #17467 # This used to fail for each i in 0..<26844, i.e. the 1st produced value # was predictable and < 1e-4, skewing distributions. -const withUint = false # pending exporting `proc rand[T: uint | uint64](r: var Rand; max: T): T =` - -block: # bug #16360 +block: # bug #16360, Natural overload var r = initRand() template test(a) = let a2 = a @@ -206,23 +204,38 @@ block: # bug #16360 let a3 = rand(a2) doAssert a3 <= a2 doAssert a3.type is a2.type - when withUint: - test cast[uint](int.high) - test cast[uint](int.high) + 1 - whenJsNoBigInt64: discard - do: - test uint64.high - test uint64.high - 1 - test uint.high - 2 - test uint.high - 1 - test uint.high test int.high test int.high - 1 test int.high - 2 test 0 - when withUint: - test 0'u - test 0'u64 + +block: # same as above but use slice overload + var r = initRand() + template test[T](a: T) = + let a2: T = a + block: + let a3 = r.rand(T(0) .. a2) + doAssert a3 <= a2 + doAssert a3.type is a2.type + block: + let a3 = rand(T(0) .. a2) + doAssert a3 <= a2 + doAssert a3.type is a2.type + test cast[uint](int.high) + test cast[uint](int.high) + 1 + whenJsNoBigInt64: discard + do: + test uint64.high + test uint64.high - 1 + test uint.high - 2 + test uint.high - 1 + test uint.high + test int.high + test int.high - 1 + test int.high - 2 + test 0 + test 0'u + test 0'u64 block: # bug #16296 var r = initRand() diff --git a/tests/stdlib/tssl.nim b/tests/stdlib/tssl.nim index 0e3f9cd82..1628b9326 100644 --- a/tests/stdlib/tssl.nim +++ b/tests/stdlib/tssl.nim @@ -1,11 +1,11 @@ discard """ matrix: "--mm:refc; --mm:orc" joinable: false - disabled: "freebsd" - disabled: "openbsd" - disabled: "netbsd" + disabled: "freebsd" # see #15713 + disabled: "openbsd" # see #15713 + disabled: "netbsd" # see #15713 """ -# disabled: pending bug #15713 + import std/[net, nativesockets, assertions, typedthreads] when defined(posix): import os, posix diff --git a/tests/system/tdollars.nim b/tests/system/tdollars.nim index 913db7c86..39337cca7 100644 --- a/tests/system/tdollars.nim +++ b/tests/system/tdollars.nim @@ -45,8 +45,7 @@ block: # `$`(SomeInteger) check $int8.low == "-128" check $int8(-128) == "-128" - when not defined js: # pending https://github.com/nim-lang/Nim/issues/14127 - check $cast[int8](-128) == "-128" + check $cast[int8](-128) == "-128" var a = 12345'u16 check $a == "12345" diff --git a/tests/vm/tvmmisc.nim b/tests/vm/tvmmisc.nim index c29dd5010..11fdcbd8c 100644 --- a/tests/vm/tvmmisc.nim +++ b/tests/vm/tvmmisc.nim @@ -291,7 +291,7 @@ block: # bug #10815 const a = P() doAssert $a == "" -when defined osx: # xxx bug https://github.com/nim-lang/Nim/issues/10815#issuecomment-476380734 +when defined osx: # xxx bug #13481 block: type CharSet {.union.} = object cs: set[char] diff --git a/tools/kochdocs.nim b/tools/kochdocs.nim index bab2de1e4..60d4bc673 100644 --- a/tools/kochdocs.nim +++ b/tools/kochdocs.nim @@ -1,6 +1,6 @@ ## Part of 'koch' responsible for the documentation generation. -import std/[os, strutils, osproc, sets, pathnorm, sequtils] +import std/[os, strutils, osproc, sets, pathnorm, sequtils, pegs] import officialpackages export exec @@ -8,9 +8,6 @@ export exec when defined(nimPreviewSlimSystem): import std/assertions -# XXX: Remove this feature check once the csources supports it. -when defined(nimHasCastPragmaBlocks): - import std/pegs from std/private/globs import nativeToUnixPath, walkDirRecFilter, PathEntry import "../compiler/nimpaths" @@ -373,9 +370,7 @@ proc buildDocs*(args: string, localOnly = false, localOutDir = "") = if not localOnly: buildDocsDir(args, webUploadOutput / NimVersion) - # XXX: Remove this feature check once the csources supports it. - when defined(nimHasCastPragmaBlocks): - let gaFilter = peg"@( y'--doc.googleAnalytics:' @(\s / $) )" - args = args.replace(gaFilter) + let gaFilter = peg"@( y'--doc.googleAnalytics:' @(\s / $) )" + args = args.replace(gaFilter) buildDocsDir(args, localOutDir) |