diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | compiler/semexprs.nim | 2 | ||||
-rw-r--r-- | koch.nim | 8 | ||||
-rw-r--r-- | lib/system/sysio.nim | 8 | ||||
-rw-r--r-- | tests/sets/tsets.nim | 10 |
5 files changed, 28 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore index fc090130b..f2037c1b8 100644 --- a/.gitignore +++ b/.gitignore @@ -58,6 +58,7 @@ dist/ .*/ ~* -# testament cruft +# testament cruft; TODO: generate these in a gitignore'd dir in the first place. testresults/ test.txt +/test.ini diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index d7a0d7b8b..c9f9eb33f 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -2127,7 +2127,7 @@ proc semSetConstr(c: PContext, n: PNode): PNode = n.sons[i] = semExprWithType(c, n.sons[i]) if typ == nil: typ = skipTypes(n.sons[i].typ, {tyGenericInst, tyVar, tyLent, tyOrdinal, tyAlias, tySink}) - if not isOrdinalType(typ): + if not isOrdinalType(typ, allowEnumWithHoles=true): localError(c.config, n.info, errOrdinalTypeExpected) typ = makeRangeType(c, 0, MaxSetElements-1, n.info) elif lengthOrd(c.config, typ) > MaxSetElements: diff --git a/koch.nim b/koch.nim index 133c7e32b..ad6a774e8 100644 --- a/koch.nim +++ b/koch.nim @@ -242,7 +242,15 @@ proc zip(args: string) = exec("$# --var:version=$# --var:mingw=none --main:compiler/nim.nim zip compiler/installer.ini" % ["tools/niminst/niminst".exe, VersionAsString]) +proc ensureCleanGit() = + let (outp, status) = osproc.execCmdEx("git diff") + if outp.len != 0: + quit "Not a clean git repository; 'git diff' not empty!" + if status != 0: + quit "Not a clean git repository; 'git diff' returned non-zero!" + proc xz(args: string) = + ensureCleanGit() bundleNimbleSrc() bundleNimsuggest(false) nimexec("cc -r $2 --var:version=$1 --var:mingw=none --main:compiler/nim.nim scripts compiler/installer.ini" % diff --git a/lib/system/sysio.nim b/lib/system/sysio.nim index 2ece56916..7a10849dd 100644 --- a/lib/system/sysio.nim +++ b/lib/system/sysio.nim @@ -417,12 +417,18 @@ proc setStdIoUnbuffered() = discard c_setvbuf(stdin, nil, IONBF, 0) when declared(stdout): + when defined(windows) and compileOption("threads"): + var echoLock: SysLock + initSysLock echoLock + proc echoBinSafe(args: openArray[string]) {.compilerProc.} = # flockfile deadlocks some versions of Android 5.x.x when not defined(windows) and not defined(android) and not defined(nintendoswitch): proc flockfile(f: File) {.importc, noDecl.} proc funlockfile(f: File) {.importc, noDecl.} flockfile(stdout) + when defined(windows) and compileOption("threads"): + acquireSys echoLock for s in args: discard c_fwrite(s.cstring, s.len, 1, stdout) const linefeed = "\n" # can be 1 or more chars @@ -430,5 +436,7 @@ when declared(stdout): discard c_fflush(stdout) when not defined(windows) and not defined(android) and not defined(nintendoswitch): funlockfile(stdout) + when defined(windows) and compileOption("threads"): + releaseSys echoLock {.pop.} diff --git a/tests/sets/tsets.nim b/tests/sets/tsets.nim index 96d5debc7..13a5f54e6 100644 --- a/tests/sets/tsets.nim +++ b/tests/sets/tsets.nim @@ -205,4 +205,12 @@ echo warnUninit in gNotes # 7555 doAssert {-1.int8, -2, -2}.card == 2 -doAssert {1, 2, 2, 3..5, 4..6}.card == 6 \ No newline at end of file +doAssert {1, 2, 2, 3..5, 4..6}.card == 6 + +type Foo = enum + Foo1 = 0 + Foo2 = 1 + Foo3 = 3 + +let x = { Foo1, Foo2 } +# bug #8425 |