Commit Graph

8802 Commits

Author SHA1 Message Date
xioren
478f717377 Move async example to asynchronous version of proc (#18078)
* improve runnableExamples in std/httpclient

* Add synchronous example.

* Update lib/pure/httpclient.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-05-24 20:56:31 -07:00
Timothee Cour
d217888e56 close #18009 parseJson JInt vs JFloat; preserve -0.0 as JFloat to distinguish from 0.0 (#18067) 2021-05-23 23:06:14 +02:00
Andrey Makarov
9f7e2e3057 docs: make inline markup more compatible with Markdown (#18053)
fixes https://github.com/timotheecour/Nim/issues/739
2021-05-21 06:54:20 +02:00
Ștefan Talpalaru
a1c82c39af asyncdispatch+stackTraceOverride: fix premature collection (#18039) [backport:1.2]
Copying StackTraceEntry instances when nimStackTraceOverride is defined
breaks the link between a cstring field that's supposed to point at
another string field in the same object.

Sometimes, the original object is garbage collected, that memory region
reused for storing other strings, so when the StackTraceEntry copy tries
to use its cstring pointer to construct a traceback message, it accesses
unrelated strings.

This only happens for async tracebacks and this patch prevents that by
making sure we only use the string fields when nimStackTraceOverride is
defined.

Async tracebacks also beautified slightly by getting rid of an extra line
that was supposed to be commented out, along with the corresponding debugging output.

There's also a micro-optimisation to avoid concatenating two strings just
to get their combined length.
2021-05-19 19:19:11 +02:00
Andreas Rumpf
7052503ca8 make strformat part of the prelude (#18046) 2021-05-19 19:18:16 +02:00
Andreas Rumpf
53935b8b27 ARC: fixes memory leaks with newSeq used in a loop [backport:1.4] (#18040)
* ARC: fixes memory leaks with newSeq used in a loop [backport:1.4]
* Update tests/arc/tnewseq_legacy.nim
2021-05-18 21:45:37 +02:00
Timothee Cour
7f077a76fe jsonutils: add customization for toJson via ToJsonOptions; generalize symbolName; add symbolRank (#18029)
* jsonutils: add customization for toJson via `ToJsonOptions`

* add enumutils.symbolRank

* lookup table implementation for HoleyEnum

* cleanup

* changelog

* fixup

* Update lib/std/jsonutils.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-05-18 15:10:19 +02:00
Antonis Geralis
6e0fe965da add sink and lent annotations for xmltree and streams (#18037) 2021-05-18 08:16:07 +02:00
Joey
e904c6d87c Add checked to dom (#18033)
This allows the ability to set a checkbox as checked programmatically. It's different from `setAttribute` because once an input has been clicked on by the user, `setAttribute` no longer works programmatically.
2021-05-17 08:04:39 +02:00
Andrey Makarov
2096490b59 follow-up #17930 - inline syntax highlighting (#18013)
* follow-up #17930 - inline syntax highlighting

* make closure->nimcall
2021-05-16 23:55:14 +02:00
Timothee Cour
d83b25db1e fix #18007: std/json now serializes nan,inf,-inf as strings instead of invalid json (#18026)
* fix #18007: std/json now serializes nan,inf,-inf as raw strings instead of invalid json

* fix roundtrip

* fix tests

* fix changelog

* simplify

* add runnableExamples

* fix typo [skip ci]
2021-05-16 23:54:10 +02:00
flywind
65f6b66820 Revert "[std/re]fix terrible and strange interface" (#18027)
This reverts commit c218f2ba0b.
2021-05-16 11:10:41 +08:00
flywind
c218f2ba0b [std/re]fix terrible and strange interface 2021-05-16 10:39:52 +08:00
Thomas T. Jarløv
99788ee504 Escape %00 / \0 in dbQuote (#18015) [backport:1.4]
Fix https://github.com/nim-lang/Nim/issues/17925
2021-05-15 21:26:15 +02:00
Andrey Makarov
3824fd3f9a RST opt.list to have priority over def.list (#17845) 2021-05-15 08:12:26 +02:00
Andreas Rumpf
4857c462d5 Revert "fix #14873 properly by skipping abi field in importc type (#17944)" (#17992)
This reverts commit 98c29c01eb.
2021-05-15 06:50:39 +02:00
Timothee Cour
2ce592a209 refs #18011 disable some newly failing tests on cpp windows; refs #17946 increase timeout for tchannels (#18012) 2021-05-14 15:33:17 -07:00
Andrey Makarov
97970d9dcc doc2tex: generate docs to Latex (#17997)
* `doc2tex`: generate docs to Latex

* address some comments
2021-05-14 07:30:47 +02:00
Andreas Rumpf
3bc625aff1 ORC: progress (#18000)
* ORC: progress

* ORC: bugfix; don't follow acyclic data even if only at runtime the subtype is marked as acyclic

* progress

* minor style changes
2021-05-12 22:00:37 +02:00
Timothee Cour
1e080eb9b4 jsonutils: handle holey enum as regular enum, via ord (#17995) 2021-05-11 22:49:47 +02:00
Timothee Cour
a770c98e27 jsonutils: support set (#17994) 2021-05-11 21:09:17 +02:00
Timothee Cour
e60672141a improve std/tempfiles (#17920)
* improve std/tempfiles
* fixup
* fix windows
* improve test
* improve runnableExamples and tests
* address comment
2021-05-11 16:35:43 +02:00
Timothee Cour
45490497e3 fix #17467 1st call to rand is now non-skewed; allow seed == 0 (#17468)
* fix #17467 1st call to rand is now non-skewed; allow passing 0 as seed

* changelog + fallback

* document behavior for seed == 0

* address comments

* _

* fix tests, disable kdtree

* re-enable kdtree with -d:nimLegacyRandomInitRand
2021-05-11 11:04:59 +02:00
Andreas Rumpf
983a2aa11c Revert "Fix parseUri to sanitize urls containing ASCII newline or tab (#17967)" (#17984)
This reverts commit f4dd95f3be.
2021-05-09 23:33:31 +02:00
Beshr Kayali
f4dd95f3be Fix parseUri to sanitize urls containing ASCII newline or tab (#17967)
* Fix parseUri to sanitize urls containing ASCII newline or tab

* Fix ups based on review

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* Additional fix ups based on review

- Avoid unnecessary `removeUnsafeBytesFromUri` call if parseUri is strict
- Move some parseUri tests to uri module test file

Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>

* Update changelog

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
2021-05-09 19:24:00 +01:00
Timothee Cour
eba1c3fd24 merge initUri() overloads, improve uri examples (#17970)
* deprecate `uri.initUri` and improve uri examples

* remove `func initUri*()` and make isIpv6 optional

* fixup
2021-05-08 16:58:30 +02:00
Andreas Rumpf
c14427dbf3 ORC: cursor inference bugfix (#17973)
* fixed a .cursor inference bug

* added a test case
2021-05-08 16:47:06 +02:00
Timothee Cour
38b41f893a fix #17941: UnusedImport works for var/let/const/type invoked inside a generic (#17942)
* fix #17941: UnusedImport works for var/let/const/type invoked inside a generic

* fixup
2021-05-08 09:56:46 +02:00
Timothee Cour
98c29c01eb fix #14873 properly by skipping abi field in importc type (#17944)
* fix #14873 properly by skipping `abi` field in importc type

* add test

* fix test for windows
2021-05-07 19:36:41 +02:00
Timothee Cour
0b4b9b3ad0 remove unsused OsPlatform.nimVM (#17953) 2021-05-07 06:55:46 +02:00
Ardek Romak
9d86639a0b Export sslHandle in net and asyncnet. (#17573) 2021-05-06 15:02:37 -07:00
Danil Yarantsev
9b126de65c Fix C++ compilation error in excpt.nim (#17951) 2021-05-06 22:33:57 +02:00
Andreas Rumpf
98cd1671a3 minor cleanups (#17948) 2021-05-06 13:27:40 +02:00
Andrey Makarov
436af88d8c follow-up #17837: add Console for interactive sessions (#17930)
* follow-up #17837: add `Console` for interactive sessions

* fix Latex
2021-05-06 10:58:01 +02:00
Juan Carlos
5762b1d75c Add copyWithin for JavaScript (#17937)
* Add jscore.copyWithin for seq and array
* Shallow copy mention docs
2021-05-05 07:46:42 +02:00
Juan Carlos
bf5dfe481a parsecsv fix style (#17933)
* ReSync with Devel
* Fix style in parsecsv
* Update lib/pure/parsecsv.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-05-04 13:13:23 +02:00
Andrey Makarov
287f1170ba highlite: fix #17890 - tokenize Nim escape seq-s (#17919)
* highlite: fix #17890 - tokenize Nim escape seq-s

* Update tests/stdlib/thighlite.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-05-03 10:21:36 +02:00
Timothee Cour
78e2d299df typo: nonexistant => nonexistent (#17918)
* typo: nonexistant => nonexistent

* fix test (ordering differs because of https://github.com/nim-lang/Nim/issues/17910)
2021-05-02 00:26:41 +02:00
Timothee Cour
ee6d56141c fix #17911 rawProc for cpp (#17912) 2021-05-01 11:12:13 +02:00
Andreas Rumpf
fb86271556 system.nim cleanup some exported constants which should never have be… (#17909)
* system.nim cleanup some exported constants which should never have been exported
2021-05-01 11:10:40 +02:00
Yanis Zafirópulos
a55c7e9679 WIP: Added missing functions to jsre module (#17881)
* added missing functions: `replace`, `replaceAll`, `split`, `match`
* added `startsWith` & `endsWith`
* Update lib/js/jsre.nim

Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>
2021-05-01 09:37:02 +02:00
flywind
9f75e8abc1 [std/base64] uses runnableExamples (#17882)
* [std/base64] uses runnableExamples
* Update lib/pure/base64.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2021-05-01 07:27:50 +02:00
Timothee Cour
82996aee3f misc fixes: remove forceConst (obsolete by static), add more runnableExamples to system (#17896)
* misc fixes

* add runnableExamples for compileOption

* add runnableExamples for runnableExamples

* move tconsteval => tconst

* cleanup
2021-05-01 07:26:52 +02:00
Andrey Makarov
abb8a73134 Fix nim-lang/nimforum#285 - punctuation after URL (#17908)
* Fix nim-lang/nimforum#285 - punctuation after URL
* keep only one leaf in a rnStandaloneHyperlink
* add more complex URL
2021-05-01 07:20:33 +02:00
Gabriel Huber
34a09574ce Document the difference between toFloat/toInt and type conversion (#17894) 2021-04-30 22:39:25 +02:00
Timothee Cour
d32ab61e61 fix #17905: hash(closure) was not being tested (#17906) 2021-04-30 12:40:39 -07:00
Timothee Cour
3192995ac9 close #16646; since now works with bootstrap nim post csources_v1 (#17895)
* revive #16627 now that csources_v1 was merged

* use dedent in rst.nim, refs https://github.com/nim-lang/Nim/pull/17257#discussion_r589025683

* fix test and improve rendering of a rst warning
2021-04-30 18:54:47 +02:00
Timothee Cour
20248a68fd gitutils: add diffStrings, diffFiles, and use it in testament to compare expected vs gotten (#17892)
* gitutils: add diffStrings, diffFiles, and use it in testament to compare expected vs gotten
* refactor with createTempDir
* cleanup
* refacotr
* PRTEMP fake test spec changes to show effect of diffStrings
* add runnableExamples for experimental/diff + cross-reference with gitutils
* Revert "PRTEMP fake test spec changes to show effect of diffStrings"

This reverts commit 57dc8d642d.
2021-04-30 11:00:33 +02:00
Andrey Makarov
1640508348 more strict RST inline markup parsing (#17827)
* more strict RST inline markup parsing
* add test for unexpected bonus
* introduce `roPreferMarkdown`
2021-04-29 17:31:15 +02:00
Fröhlich A
5439cfc317 Fix insert calling wrong function (#17856)
The `insert` method is calling `tryInsertID`, which ignores the `pkName` parameter.
Calling `tryInsert` instead should be correct.
2021-04-29 14:11:05 +02:00