Commit Graph

14401 Commits

Author SHA1 Message Date
Neelesh Chandola
7c5ae00887 exportc is now not allowed for type aliases (#9979) 2019-01-02 20:01:06 +01:00
Oscar Nihlgård
9fb8c3d965 Add {.noReturn.} to system.raiseAssert (#10161) 2019-01-02 17:39:53 +01:00
Timothee Cour
a1e268e3dc [cleanup] remove dead code compiler.options.mergeConfigs (#10165) 2019-01-02 10:26:40 +01:00
Ico Doornekamp
31b8bc7866 Add link to tutorial part III to docs.rst (#10157) [ci skip] 2019-01-01 19:49:29 +01:00
Neelesh Chandola
6ed9676af5 Show field not initialized warning only when notnil used (#10155) 2019-01-01 18:49:44 +01:00
Neelesh Chandola
9faad7591e Deprecate gc v2 (#10151)
* Deprecate gc v2

* warnDeprecated now has custom messages
2019-01-01 13:50:48 +01:00
jiro
e7fa8f3443 Add Example code to Documentation comment of wordWrap proc. (#10146) 2019-01-01 09:56:59 +01:00
cooldome
7c90e22ddd fixes #10148 (#10149)
* fixes #10148
* fix a typo
2018-12-31 22:57:09 +01:00
Timothee Cour
ab72d68ec8 fix off by 1 error in col shown by toFileLineCol (#10138)
* fix off by 1 error in `col` shown by toFileLineCol
* fix test failures
2018-12-31 15:42:01 +01:00
c-blake
7ac1fc81fd Resolve things raised in https://github.com/nim-lang/Nim/issues/10081 ? (#10084)
* Resolve things raised in https://github.com/nim-lang/Nim/issues/10081 ?
CDF is a standard ident in all things related to random numbers/sampling,
and full words "cumulativeDistributionFunction" would be silly long, in
this case, IMO.  We use lowercase `cdf` to make it not look like a type,
remove all looping from `sample` letting callers do it.  Besides just
side-stepping any `sampleSize` name choice, callers may want to filter
out samples anyway which this makes slightly simpler.

Also add two variants of `cumsum`, value return and in-place update
distinguished by the var-ness of the first argument.  Add tests for
`int` and `float` for both `cumsum` and the new `sample`.  (The sample
tests exercise the value return mode of `cumsum`.)

Functionality pre-this-PR `sample(a, w)` is now the almost as simple
`for i in 0..<n: sample(a, w.cumsum)`, but this new code factoring is
almost surely better.  The statistical tests pass, as before.

* Address Araq comment in https://github.com/nim-lang/Nim/pull/10084
We can always add in some `var` version later if desired to save
memory, but this change now at least firms up the `sample` interface.

* Rename `cumsum` -> `cumsummed` to honor NEP1 style.  Re-instate `cumsum` as
the in-place transformation.  Test both in `tests/stdlib/tmath.nim` and use
`cumsummed` in the example code for sample since that's a simpler example.

* Fix requests from https://github.com/nim-lang/Nim/pull/10084 :
  example in lib/pure/math.nim and comment whitespace in lib/pure/random.nim
2018-12-31 14:52:51 +01:00
deech
e87910197a Check there are no side effects before optimizing away compile time expressions. (#9934) 2018-12-31 14:41:24 +01:00
Neelesh Chandola
bcbe317d17 Before showing deprecated warning, check whether enum field was marked deprecated or the whole enum type (#10135) 2018-12-30 18:34:41 +01:00
Andreas Rumpf
2ee2022c29 help Nim optimize intsets.initIntSet 2018-12-30 11:45:16 +01:00
cooldome
82c009a2cb Dead code elimination for entire modules and their init procs if empty (#10032)
* fixes #9798
* Change order of write modules
* Move datInit calls ahead of initStackBottom
2018-12-30 11:28:12 +01:00
Neelesh Chandola
cbbdcb2669 Show deprecation warning for fields of a deprecated enum (#10112)
* Show deprecation warning for fields of a deprecated enum

* Add test
2018-12-30 09:45:39 +01:00
Neelesh Chandola
c5ad4c10cb Deprecated pragma is now supported on enum fields (#10113)
* {.deprecated.} pragma is now supported for enum fields
* Add tests
* Simplify code
2018-12-30 09:43:59 +01:00
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
Andreas Rumpf
062d7e3a39 fixes #10082 2018-12-30 02:45:43 +01:00
Timothee Cour
dd33f41877 refs #10121 (#10124) 2018-12-30 02:06:15 +01:00
Timothee Cour
7f81195e5a document --profiler:on (#10115) 2018-12-30 01:31:30 +01:00
Neelesh Chandola
527b774772 {.push raises: [].} is now ignored for vars/lets/consts (#10026) 2018-12-30 01:28:56 +01:00
Timothee Cour
e98d54b050 nim dump: add nimcache entry (#10122) 2018-12-30 01:27:37 +01:00
Timothee Cour
9c65ea0d16 nim c now allows: when defined(c) (#10130) 2018-12-30 01:21:33 +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
ee7
cc4720fac1 Const tuple unpacking: add tests (#10100) 2018-12-27 22:40:40 +01:00
Timothee Cour
1b7c8482fe fixes #10101 (#10103) 2018-12-27 22:40:09 +01:00
Neelesh Chandola
05b8085a87 Pragma syntax is now consistent (#9993)
* Give deprecation warning when type pragmas do not follow the type name
* pragma before generic parameter list in type definition is now deprecated
* Update changelog
* Fix bug where deprecated warning was being shown even though no generic param list was present
* Fix bug
* Use errGenerated
* Best attempt at writing the grammar
2018-12-27 22:38:24 +01:00
Timothee Cour
8948894713 [ci skip] update docs for build_all.sh (#10086) 2018-12-27 22:28:08 +01:00
alaviss
ca0ef62c9e config/nim.cfg: disable tlsEmulation on Haiku (#10092) [backport]
As of hrev52662, TLS support in Haiku is usable again. This has since
been backported to R1/Beta1, so we can flip the switch upstream.
2018-12-27 22:27:23 +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
Neelesh Chandola
65a52ecebb Fix const tuple unpacking not working for variables > 2 (#10099) 2018-12-27 00:50:33 +01:00
alaviss
58d293d6a9 fixes nim-lang/nimsuggest#76 (#10093)
* nimsuggest: prevent out-of-bound access

* fixes nim-lang/nimsuggest#76

* undo tester changes
2018-12-25 21:08:16 +01:00
Timothee Cour
5f2b66751a fix #10049 (#10083) 2018-12-23 23:00:37 +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
Araq
d407af565f fixes #10024 2018-12-22 23:13:05 +01:00
Araq
bdb67201b2 fixes #10033 [backport] 2018-12-22 18:39:20 +01: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
237085db5d C++ tests: make DLL test green 2018-12-21 22:03:41 +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