Commit Graph

6616 Commits

Author SHA1 Message Date
Timothee Cour
a6633b9658 fix typetraits.$ regression https://github.com/c-blake/cligen/issues/84 (#10131)
* fix typetraits.`$` regression https://github.com/c-blake/cligen/issues/84
* add test
2018-12-30 09:40:21 +01:00
Alexander Ivanov
aadbdd6b06 Support undefined in isNil (#9960) 2018-12-30 02:48:37 +01:00
Timothee Cour
dd33f41877 refs #10121 (#10124) 2018-12-30 02:06:15 +01:00
Timothee Cour
0831292863 revives: Move typetraits.$ to system. Fixes #5827 (#10071)
* Move typetraits.`$` to system. Fixes #5827.
* revive PR; adjust code to make sure everything works and add tests
* fix tests/concepts/tstackconcept.nim
* address comments
2018-12-30 01:09:47 +01:00
Timothee Cour
eba8ffcf70 checkErr now shows actual system error msg instead of unknown error (#9987) 2018-12-27 22:46:53 +01:00
Dominik Picheta
e3cee541bd Fixes long-standing asynchttpserver regression. (#10102) 2018-12-27 22:26:48 +01:00
Dominik Picheta
513a287c61 Revert sub-second randomize(). Fixes randomize for JS backend. (#10000)
Fixes #9999.
2018-12-27 11:55:21 +01:00
c-blake
e1d5356ae9 Add ability to sample elements from openArray according to a weight array (#10072)
* Add the ability to sample elements from an openArray according to a parallel
array of weights/unnormalized probabilities (any sort of histogram, basically).
Also add a non-thread safe version for convenience.

* Address Araq comments on https://github.com/nim-lang/Nim/pull/10072

* import at top of file and space after '#'.

* Put in a check for non-zero total weight.

* Clarify constraint on `w`.

* Rename `rand(openArray[T])` to `sample(openArray[T])` to `sample`, deprecating
old name and name new (openArray[T], openArray[U]) variants `sample`.

* Rename caller-provided state version of rand(openArray[T]) and also clean
up doc comments.

* Add test for new non-uniform array sampler.  3 sd bound makes it 99% likely
that it will still pass in the future if the random number generator changes.
We cannot both have a tight bound to check distribution *and* loose check to
ensure resilience to RNG changes.  (We cannot *guarantee* resilience, anyway.
There's always a small chance any test hits a legitimate random fluctuation.)
2018-12-23 12:23:20 +00:00
Oscar Nihlgård
2539363851 Don't use parseutils.parseInt in the times module (#10028) 2018-12-22 10:41:54 +01:00
Andreas Rumpf
ca672ec62e appveyor: make the build green again 2018-12-22 09:47:22 +01:00
Alexis Hope
bec493925f IntSet documentation notes (#10051) 2018-12-21 22:55:58 +01:00
Taylor Hoff
8869aa74db Stop false positives in distros.detectOs (#10062)
* Stop false positives in distros.nim

* Fix bad string comparison on line 176 of distros.nim
2018-12-21 22:52:57 +01:00
Timothee Cour
8aa5d126fe clarify doc for <= on tuple uses lexicographic order (#10069) 2018-12-21 22:52:28 +01:00
Yuriy Glukhov
39a8ab469a Fixed insert for nil seq in js (#10068) 2018-12-21 22:45:20 +01:00
Araq
4a6d699bc5 C++: make async tests green on Windows 2018-12-21 22:03:41 +01:00
hlaaf
da80992577 Add system.$(HSlice) and fix #7898 (#8670)
* Add system.$(HSlice) and fix #7898

* Surround system.$(HSlice) with spaces
2018-12-21 18:10:07 +01:00
Araq
0c97d3a41c fixes #10066 2018-12-21 14:28:52 +01:00
alaviss
b6257f3f21 os.walkDir: correctly evaluate paths when relative = true (#10057) [backport] 2018-12-21 14:12:48 +01:00
Taylor Hoff
68ec42cec7 Add call to hostnamectl in detectOsImpl (#10048) 2018-12-20 08:45:43 +01:00
Andreas Rumpf
cd65e5328d GC: avoid pathological behaviour; fixes #10040 [backport] (#10052) 2018-12-20 08:20:32 +01:00
Timothee Cour
6cbe1d48d7 [json] document fact that key ordering is preserved (#10020) 2018-12-20 01:13:25 +01:00
Timothee Cour
fc7df3283c fix test failure 2018-12-19 16:11:23 -08:00
Timothee Cour
656770402c fix #8255 numerous issues with splitFile 2018-12-19 16:11:23 -08:00
Araq
f7d0e5c1d1 strutils: minor code cleanup 2018-12-19 18:06:13 +01:00
Timothee Cour
37cb5e8f53 Update osproc.nim (#10043) 2018-12-19 11:25:50 +01:00
Andreas Rumpf
3300c8a500 much simpler implementation of constant tuple declarations 2018-12-19 11:11:33 +01:00
Neelesh Chandola
8e90ed0618 Const tuple unpacking (#9964)
* tuple unpacking is now supported for consts

* Move nkConstTuple to the end of TNodeKind

* Add nnkConstTuple in macros.nim

* Fix Formatting
2018-12-19 10:52:41 +01:00
Andreas Rumpf
72500420d3 Fixes #3060 and adds error checking for invalid else branches in object variants (#9957)
* Fix semRecordCase

* Fix ftpclient.nim

* Check for ordinal type

* Check tyRange for exhaustiveness
2018-12-19 10:03:22 +01:00
Neelesh Chandola
48437d0a84 Give better error message when profiler and memProfiler used at same time (#9948)
* Give better error message when profiler and memProfiler used at same time

* Move to profiler.nim
2018-12-19 10:02:20 +01:00
Timothee Cour
2d404a5a24 undo last commit (meant to send a PR instead) 2018-12-18 22:42:19 -08:00
Timothee Cour
7b9ba71b47 Update osproc.nim 2018-12-18 22:39:08 -08:00
Timothee Cour
25d3539da7 [os] fix #10017 regression, fix #10025 regression (#10018)
* [os] fix #10017 regression
* [os] fix #10025 regression
2018-12-18 12:43:25 +01:00
Andreas Rumpf
d7d17d5ab0 see what breaks with a global config.nims (#10016)
* see what breaks with a global config.nims

* make tests green with a global config.nims file
2018-12-18 09:29:15 +01:00
Timothee Cour
c4e3c4ca2d add getCurrentCompilerExe to vmops (eg allows to get nim compiler at CT); add tests for vmops (#9925) 2018-12-18 09:07:12 +01:00
Araq
09b9a54418 make tests green with a global config.nims file 2018-12-17 23:03:54 +01:00
Istvan
915a9ec082 Adding more documentation to logging.nim
Just minor addition to the documentation with the use of operators
2018-12-17 19:29:08 +01:00
Araq
9526009e0e fixes #9120 2018-12-16 20:34:07 +01:00
Araq
d91d1865b8 fixes #9420 2018-12-16 20:11:04 +01:00
Araq
d66eb04ce9 fixes #8991, fixes #4446 2018-12-16 19:22:49 +01:00
Araq
7ec77684e9 fixes #9153 2018-12-16 19:17:09 +01:00
alaviss
50193b95ea fix experimental/diff documentation rendering (#9983)
also remove references to non-existant parameters
2018-12-15 14:10:44 +01:00
Andreas Rumpf
e3a668a33b --gc:destructors: baby steps 2018-12-15 13:54:41 +01:00
c-blake
a54e3f4602 Allow an escape hatch for platform specific flags/default override (#9968)
* Allow an escape hatch for platform specific flags (of which there are many,
for example MAP_POPULATE itself is a Linux-only thing, not other Unix).

Continue with same defaults as before in this commit, but that really
should be changed to *not* include MAP_POPULATE.  While pre-faulting
all the pages can be useful sometimes *if* you know you're going to
access all the data, it is highly unlikely to be what users expect the
default to be.  For some things all that up front work is 1000s of
times slower than being lazy/on-demand/only ever faulting parts of the
file.  Even the MAP_POPULATE fan who originally in 2014 committed to
this file defaulted it to off (but turned it always-on as a "temporary"
work around for some long since gone/mutated compiler issue).

Anyway, at least something like this `mapFlags` gives users the ability
to override the poor default choice or activate any other idiosyncratic
platform-specific features.

* Use simple, efficient default flags, but also accept whatever the open/mapMem
caller specifies.  Save flags in MemFile so they can be used in `resize`.

This field should not need exporting like the others -- callers can always
save whatever values they pass -- but we include a cautionary comment in
case anyone ever asks for a `*` there, as well as for documentation.

Also make documentation for ``mapFlags`` in open more likely to inspire care.
2018-12-14 11:44:11 +01:00
Araq
3ba8f158fb added parseopt.remainingArgs; refs #9951 2018-12-14 11:41:19 +01:00
Araq
359a4b5fac timers.nim: avoid parser warning 2018-12-14 09:56:43 +01:00
Araq
ce9815bcf5 os.nim: use the new pathnorm.normalizePath implementation 2018-12-14 08:57:55 +01:00
Araq
5b39c7aca9 fixes joinPath regressions 2018-12-13 16:19:00 +01:00
Araq
9cc4a57768 os.nim: big refactoring, use the new pathnorm that was extracted by compiler/pathutils.nim; added os.relativePath 2018-12-13 12:05:50 +01:00
Neelesh Chandola
b2411db541 Merge remote-tracking branch 'upstream/devel' into record-case 2018-12-13 13:59:46 +05:30
Neelesh Chandola
a3c4791e9c Give error when case has an else branch even though all cases are already covered (#9930)
* Give error when case has an else branch even though all cases are already covered.
* Don't check for invalid else for type tyFloat..tyFloat128, tyString, tyError
* Remove unnecessary else in unittest.nim
* Fix sockets.nim
2018-12-13 09:08:10 +01:00