Commit Graph

14438 Commits

Author SHA1 Message Date
Timothee Cour
6ce3949c8a add isNamedTuple; make $(1, 2) be (1, 2) instead of (Field0: 1, Field1: 2) which leaked implementation detail (#10070)
* add `isNamedTuple`; make $(1, 2) be (1, 2) instead of leaking implementation detail (Field0: 1, Field1: 2)
  fixes this: #8670 (comment) /cc @alehander42 @Vindaar @mratsim

* Note: isNamedTuple is useful in other places, eg #10010 (comment)

* move isNamedTuple to helpers.nim to avoid exposing new symbol to system.nim

* remove workaround in tests/vm/tissues.nim failing test now that #10218 was makes it work
2019-01-08 18:37:25 -08:00
Timothee Cour
bf3a308e86 [error messages, stacktraces] fix #8794 #9270 #9767 #9768 (#9766)
* fixes #8794 : `Error: undeclared field: 'foo'` should show type (+ where type is defined) (hard to guess in generic code)

* fixes #9270: `--listFullPaths` not honored by `declared in foo.nim` messages

* fixes #9767: VM stacktrace doesn't honor --excessiveStackTrace:on

* fixes #9768: VM stacktrace misses column info, can lead to ambiguous or harder to read stacktraces

* refactors some col+1 code to col + ColOffset (self documents code)

* make getProcHeader show declared info location also for types and all routine kinds (including macros,templates) instead of just (rather arbitrarily) for iterator,proc,func,method

* --listFullPaths now is honored in more places

* fix typo system/except.nim => lib/system/excpt.nim

* remove substr(foo, 0) hack in compiler/vm.nim which seems old and not applicable anymore
2019-01-08 15:58:47 -08:00
Neelesh Chandola
fb26b95f81 {.deprecated: msg.} now works for vars and lets (#10234) 2019-01-08 19:44:47 +01:00
narimiran
d0366c5194 update issue templates [ci skip] 2019-01-08 15:30:15 +01:00
Timothee Cour
c60916a2af [CI] fixes #10041 move bulk of travis and appveyor logic to koch.nim (#10183) 2019-01-08 13:08:19 +01:00
alaviss
6737634d88 os.execShellCmd: fixes #10231 (#10232)
Darwin has long deprecated the wait union, but their macros still assume
it unless you define _POSIX_C_SOURCE. This trips up C++ compilers.

This commit duplicates the behavior of WEXITSTATUS when _POSIX_C_SOURCE
is defined.
2019-01-08 12:41:15 +01:00
Timothee Cour
821920aa39 [nimpretty] fix #10211; fix #10199 (#10212)
* [nimpretty] fix #10211; fix #10199
* address comments
* un-document --backup and set its default to false
2019-01-08 10:38:34 +01:00
Clyybber
427435a814 Don't use deprecated pragma syntax (#10187)
* Don't use deprecated pragma syntax

* Remove pure pragma, since it's a noop now
2019-01-08 10:13:39 +01:00
treeform
3ed833198b Better LibSSL search order. (#10230) 2019-01-08 09:50:25 +01:00
alaviss
20402579a2 system/strmantle: avoid leaking docs to system.nim [ci skip] (#10233)
thanks @timotheecour for spotting this
2019-01-08 08:42:10 +01:00
Arne Döring
abad758a7e Fix for sizeof bitsize combination (#10227)
* fix #10082

* added test
2019-01-07 18:09:57 +01:00
Neelesh Chandola
387831d657 Show error when trying to export individual enum field (#10109) 2019-01-07 16:02:47 +01:00
jcosborn
044cef152f add custom pragma support for var and let symbols (#9582)
* add custom pragma support for var and let symbols
* updated changelog for custom pragmas on var and let symbols
* add oldast switch for backwards compatibility
2019-01-07 12:36:06 +01:00
alaviss
139fa396e8 os.execShellCmd: use WEXITSTATUS to retrieve exit code (#10222)
According to POSIX, system() shall returns the termination status in the
format specified by waitpid(), which means WEXITSTATUS should be used to
retrieve the exit code portably.

This fixes execShellCmd on Haiku.
2019-01-07 12:27:07 +01:00
zah
87f8ec5b92 Fix #10073 (#10218) 2019-01-07 12:10:54 +01:00
Miran
5345c5b130 remove deprecated modules (#10215)
* removed from `compiler`:
    * lists (deprecated 2 years ago)

* removed from `lib` (all deprecated 3 years ago):
    * ssl
    * matchers
    * httpserver

* removed from `lib/deprecated`:
    * unsigned
    * actors (and three accompanying tests)
    * parseurl

* moved to `lib/deprecated`:
    * securehash (the reason for not directly removing - it was deprecated (only) one year ago)
2019-01-07 10:37:49 +01:00
Ico Doornekamp
be9d1280ae Added examples to strtabs module (#10160) 2019-01-07 00:52:19 +01:00
Neelesh Chandola
e77dd683eb Fix defer not not-working at top level (#10191) 2019-01-07 00:51:17 +01:00
Alexander Ivanov
15773c455a Add changelog for the isNil JavaScript change (#10184)
Forgot to add an item,  breaking change
2019-01-07 00:50:21 +01:00
Leonardo Cecchi
b7be67349b Fix ODBC SQL Error string decoding (#10207) [backport]
ODBC Errors were presented to the users as a sequence of characters.
I.e.:

    >test_oracle.exe

    Error: ['H', 'Y', '0', '0', '0', '\x00', '\x00', ...]

    test_oracle.nim(15)      test_oracle
    test_oracle.nim(8)       test_oracle
    db_odbc.nim(534)         open
    db_odbc.nim(168)         dbError
    Error: unhandled exception: ODBC Error [DbError]

This patch fix the string decoding, creating a real string:

    >test_oracle.exe

    Error: HY000 [Oracle][ODBC][Ora]ORA-12541: TNS:no listener

    test_oracle.nim(15)      test_oracle
    test_oracle.nim(8)       test_oracle
    db_odbc.nim(534)         open
    db_odbc.nim(168)         dbError
    Error: unhandled exception: ODBC Error [DbError]
2019-01-07 00:48:55 +01:00
c-blake
ea3e32c224 Remove totally unneeded import of hashes. (#10221) 2019-01-07 00:42:49 +01:00
Federico Ceratto
2fa35126b0 Fix getAddrInfo, add IPPROTO_ICMPV6 Closes #10198 2019-01-06 20:23:44 +00:00
Tristano Ajmone
f3bd3691e7 Minor Fixes to Manual Wording (#10214) 2019-01-06 10:45:24 +01:00
Timothee Cour
4a720394bb testament megatest: we can now tell which test failed; helps debugging and prevents certain bugs, plus other fixes (#10089)
* [testament] --verboseMegatest flag to make megatest compilation verbose
* replace "tests" by testsDir
* megatest's nimcache is now in same dir as other tests to avoid clobbering (eg when running tests from multiple Nim repos)
2019-01-05 16:07:09 +01:00
Timothee Cour
ffea3fbfae * move up runnableExamples definition so can be used more in system.nim (#10196)
* document that toInt, toBiggestInt round towards 0 and add runnableExamples
* minor doc fixes
2019-01-05 16:01:10 +01:00
Hugo Locurcio
e5ca57d85c Fix the tuple returned by os.splitFile() in documentation (#10197) 2019-01-05 01:00:38 +01:00
alaviss
be0a4d1342 fix system.nim documentations (#10168)
* system: fix nimGC_getStackBottom doc
* system/helpers: avoid leaking docs to system
2019-01-04 15:13:07 +01:00
Neelesh Chandola
e9a192c36f expandFilename on windows is now consistent with other platforms (#10154) 2019-01-04 15:11:48 +01:00
rec
ba7d33b4e4 Guard against null exception (#10162) 2019-01-04 15:05:03 +01:00
Tristano Ajmone
4eee92a7a3 Fix Typo in Compiler Guide (#10189)
Change 'ableit' to 'albeit'.
2019-01-04 14:37:07 +01:00
Timothee Cour
319b46230c fix bug in doAssertRaises when exception==Exception (#10172)
* fix bug in doAssertRaises when exception==Exception
* add testcase for doAssertRaises
2019-01-04 13:54:02 +01:00
Araq
5101b6befd fixes #10188 2019-01-04 13:39:54 +01:00
Miran
69149a0e92 [backport] improve unicode docs, fixes #2353 (#10174)
* as instructed in #2353, provides a short description why
there are no specialized procs for seq[Rune]
* adds several examples to better explain what some functions do
* small fixes (double backticks, add missing dots, etc.)
* use `rune` instead of "unicode characer"
2019-01-04 13:20:12 +01:00
Neelesh Chandola
db7ff50fe5 Undocument --genmapping (#10175) 2019-01-04 10:43:29 +01:00
Araq
086229459a runnableExamples: compile and test them as a single file; fixes #9300 2019-01-04 09:52:22 +01:00
Miran
77166ba795 [backport] correctly document toInt, fixes #2764 [ci skip] (#10176) 2019-01-04 09:25:58 +01:00
Araq
e6cbf9e790 koch.nim: speed up tests for the 'testinstall' target for the nightly builds (these tests are also covered by the other CIs) 2019-01-03 23:45:42 +01:00
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