summary refs log tree commit diff stats
Commit message (Collapse)AuthorAgeFilesLines
* fix #13515 [backport] (#20315)metagn2022-09-112-1/+23
| | | | | | | | | | | * fix #13515 * only compile test * no idea why this PR is unlocking this * don't rope in symchoices * even more restrictive
* SSL: Allow the same range of versions for OSX (#20324)Andreas Rumpf2022-09-101-5/+1
|
* Markdown links migration part 1 (#20319)Andrey Makarov2022-09-0912-240/+256
| | | | | | | | | | | | | Markdown link migration part 1 Also the warning is improved a bit. Local links (targeting inside its document) which had had a full anchor were turned into concise form. The very fact that they existed may be due to the bug in reference to subsections fixed https://github.com/nim-lang/Nim/pull/20279, now they are working well (both in RST syntax and new Pandoc Markdown syntax implemented in https://github.com/nim-lang/Nim/pull/20304)
* update manual (#20325)Judd2022-09-091-2/+4
| | | | 1. remove two redundant `.`; 1. add information on format string for `importc` just as `exportc`
* fixes nightlies build regression (#20322)ringabout2022-09-081-1/+1
| | | fixes nightlies build
* Update manual.md (#20321)Judd2022-09-081-3/+5
| | | | | | | | | * Update manual.md add explanation for $#. * Update manual.md add explanation.
* Revert "clarify that `char` may not be unsigned" (#20320)ringabout2022-09-081-1/+1
| | | | | Revert "clarify that `char` may not be unsigned (#20308)" This reverts commit f433d9cccf1a05da1a24e9fed9b914b7a2a35945.
* fixes #20303; wasMoved expressions with side effects for ORC (#20307) [backport]ringabout2022-09-082-2/+38
| | | fixes #20303; wasMoved expressions with side effects
* clarify that `char` may not be unsigned (#20308)ringabout2022-09-061-1/+1
|
* give a deprecate warning when using `newPar` to construct tuple expressions ↵ringabout2022-09-062-3/+8
| | | | | | | | | (#20312) * error/deprecate when using `newPar` to construct tuple expressions * Update lib/core/macros.nim * fixes
* Replace `if` by `case` in JS `isSimpleExpr` (#20267)Amjad Ben Hedhili2022-09-061-5/+7
| | | use case stmt
* use arrow precedence in spec (#20166)metagn2022-09-062-1/+8
| | | | | | | * test using arrow precedence in spec refs #8759 * add test for #8759
* fixes #9462; jsondoc --index can generate a theindex.json (#20205)ringabout2022-09-063-10/+29
|
* overloadable enums no longer experimental (#20298)metagn2022-09-0512-41/+27
| | | depends on #20126
* Prevent use-after-free bugs in object variants. Fixes bug #20305 (#20300) ↵Antonis Geralis2022-09-051-0/+3
| | | | | | | | | | | [backport] prevent use-after-free bugs in cased objects the bug happens specifically when deleting an item in a seq. The item taking it's place might not have the same case fields. Then =sink(x[i], move x[xl]) might leave the deleted fields still in memory! If the new item switches branches again, you get a use-after-free bug.
* Implement Pandoc Markdown concise link extension (#20304)Andrey Makarov2022-09-0423-152/+325
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implement Pandoc Markdown concise link extension This implements https://github.com/nim-lang/Nim/issues/20127. Besides reference to headings we also support doing references to Nim symbols inside Nim modules. Markdown: ``` Some heading ------------ Ref. [Some heading]. ``` Nim: ``` proc someFunction*() ... ... ## Ref. [someFunction] ``` This is substitution for RST syntax like `` `target`_ ``. All 3 syntax variants of extension from Pandoc Markdown are supported: `[target]`, `[target][]`, `[description][target]`. This PR also fixes clashes in existing files, particularly conflicts with RST footnote feature, which does not work with this PR (but there is a plan to adopt a popular [Markdown footnote extension](https://pandoc.org/MANUAL.html#footnotes) to make footnotes work). Also the PR fixes a bug that Markdown links did not work when `[...]` section had a line break. The implementation is straightforward since link resolution did not change w.r.t. RST implementation, it's almost only about new syntax addition. The only essential difference is a possibility to add a custom link description: form `[description][target]` which does not have an RST equivalent. * fix nim 1.0 gotcha
* Cleanup dochack (#20299)Amjad Ben Hedhili2022-09-041-88/+36
| | | | | | | * Cleanup dochack * xxx * More cleanups
* Add improved Windows UNC path support in std/os (#20281)havardjohn2022-09-037-69/+301
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add improved Windows UNC path support in std/os Original issue: `std/os.createDir` tries to create every component of the given path as a directory. The problem is that `createDir` interprets every backslash/slash as a path separator. For a UNC path this is incorrect. E.g. one UNC form is `\\Server\Volume\Path`. It's an error to create the `\\Server` directory, as well as creating `\\Server\Volume`. Add `ntpath.nim` module with `splitDrive` proc. This implements UNC path parsing as implemented in the Python `ntpath.py` module. The following UNC forms are supported: * `\\Server\Volume\Path` * `\\?\Volume\Path` * `\\?\UNC\Server\Volume\Path` Improves support for UNC paths in various procs in `std/os`: --- * pathnorm.addNormalizePath * Issue: This had incomplete support for UNC paths * The UNC prefix (first 2 characters of a UNC path) was assumed to be exactly `\\`, but it can be `//` and `\/`, etc. as well * Also, the UNC prefix must be normalized to the `dirSep` argument of `addNormalizePath` * Resolution: Changed to account for different UNC prefixes, and normalizing the prefixes according to `dirSep` * Affected procs that get tests: `relativePath`, `joinPath` * Issue: The server/volume part of UNC paths can be stripped when normalizing `..` path components * This error should be negligable, so ignoring this * splitPath * Now make sure the UNC drive is not split; return the UNC drive as `head` if the UNC drive is the only component of the path * Consequently fixes `extractFilename`, `lastPathPart` * parentDir / `/../` * Strip away drive before working on the path, prepending the drive after all work is done - prevents stripping UNC components * Return empty string if drive component is the only component; this is the behavior for POSIX paths as well * Alternative implementation: Just call something like `pathnorm.normalizePath(path & "/..")` for the whole proc - maybe too big of a change * tailDir * If drive is present in path, just split that from path and return path * parentDirs iterator * Uses `parentDir` for going backwards * When going forwards, first `splitDrive`, yield the drive field, and then iterate over path field as normal * splitFile * Make sure path parsing stops at end of drive component * createDir * Fixed by skipping drive part before creating directories * Alternative implementation: use `parentDirs` iterator instead of iterating over characters * Consequence is that it will try to create the root directory * isRootDir * Changed to treat UNC drive alone as root (e.g. "//?/c:" is root) * This change prevents the empty string being yielded by the `parentDirs` iterator with `fromRoot = false` * Internal `sameRoot` * The "root" refers to the drive, so `splitDrive` can be used here This adds UNC path support to all procs that could use it in std/os. I don't think any more work has to be done to support UNC paths. For the future, I believe the path handling code can be refactored due to duplicate code. There are multiple ways of manipulating paths, such as manually searching string for path separator and also having a path normalizer (pathnorm.nim). If all path manipulation used `pathnorm.nim`, and path component splitting used `parentDirs` iterator, then a lot of code could be removed. Tests --- Added test file for `pathnorm.nim` and `ntpath.nim`. `pathnorm.normalizePath` has no tests, so I'm adding a few unit tests. `ntpath.nim` contains tests copied from Python's test suite. Added integration tests to `tos.nim` that tests UNC paths. Removed incorrect `relativePath` runnableExamples from being tested on Windows: --- `relativePath("/Users///me/bar//z.nim", "//Users/", '/') == "me/bar/z.nim"` This is incorrect on Windows because the `/` and `//` are not the same root. `/` (or `\`) is expanded to the drive in the current working directory (e.g. `C:\`). `//` (or `\\`), however, are the first two characters of a UNC path. The following holds true for normal Windows installations: * `dirExists("/Users") != dirExists("//Users")` * `dirExists("\\Users") != dirExists("\\\\Users")` Fixes #19103 Questions: --- * Should the `splitDrive` proc be in `os.nim` instead with copyright notice above the proc? * Is it fine to put most of the new tests into the `runnableExamples` section of the procs in std/os? * [skipci] Apply suggestions from code review Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> * [skip ci] Update lib/pure/os.nim Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> * Move runnableExamples tests in os.nim to tos.nim * tests/topt_no_cursor: Change from using splitFile to splitDrive `splitFile` can no longer be used in the test, because it generates different ARC code on Windows and Linux. This replaces `splitFile` with `splitDrive`, because it generates same ARC code on Windows and Linux, and returns a tuple. I assume the test wants a proc that returns a tuple. * Drop copyright attribute to Python Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* only allow enums to overload enums + extra test (#20126)metagn2022-09-032-2/+36
| | | mirror behavior without overloadableEnums
* remove deprecated type pragma syntax, fix bugs that required it (#20199)metagn2022-09-0344-86/+111
| | | | | | | | | | | | | | | | | | | | | | | | * remove deprecated pragma syntax from 0.20.0 closes #4651, closes #16653 with a cheap fix for now due to how early `tfFinal` is set * remove type pragma between name and generics * undo removal, try removing bind expression (0.8.14) * fix test, unremove bind expr * remove again * Update changelog.md Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> * dependencies @ HEAD & weave test dependencies * try fix package ci Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* Partially Revert "Change nim's nimble files to make it installable" (#20296)ringabout2022-09-021-0/+8
| | | add nimsuggest.nimble back
* Revert "fix #19600 No error checking on fclose (#19836)" (#20297)ringabout2022-09-022-14/+2
| | | This reverts commit 04e4a5ec0e35fc7e1c346c2d002e8487b4b48cb5.
* Fix #16937; --clib option pass library name to backend C compiler correctly ↵Tomohiro2022-09-014-1/+16
| | | | | | | | | | | | | (#19754) * Fix 16937: Make --clib option works * Make tests/compiler/tcmdlineclib.nim works from any current dir * Try to fix link error on macosx * Add a comment to tests/compiler/tcmdlineclib.nims Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* support cstring in `case` (#20130)metagn2022-09-0113-18/+126
| | | | | | | | | | | | | | | * implement case for cstring for now just converts to string on C backend * custom implementation for cstring * remove leftover * revert even more * add nil + fix packages weird variant literal bug * update docs
* remove the old nimv019 define in the config (#20133)ringabout2022-09-011-6/+0
| | | remove the olf nimv019 define in the config
* [Testament] Extend and document message testing aids (#19996)quantimnot2022-09-0115-150/+248
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [Testament] Extend and document message testing aids * Enable inline msgs when not reject action. Eliminates the pain of changing the line and column numbers in `nimout` or `output` while making changes to the test. * Enable using inline msgs and nimout together. Allows ease of inline msgs for the test as well as testing msgs from other modules. * Add path separator and test filename variable interpolation in msgs. Eases handling path separators in the msgs. * Add some documentation. * Fixed lots of broken tests * Fixed more broken tests * Support multiple inline messages per a line * Fix a broken test * Revert variable substitution in `output` * Remove uneeded params * Update doc/testament.md Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> * Update testament/specs.nim Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> * Update testament/specs.nim Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> * Fix indentation Co-authored-by: quantimnot <quantimnot@users.noreply.github.com> Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* Simpler complex division implementation (#20088)Dan Rose2022-09-011-12/+1
|
* Markdown code blocks part 6 (#20292)Andrey Makarov2022-08-316-356/+364
|
* Change nim's nimble files to make it installable (#20179)Ivan Yonchovski2022-08-313-17/+14
| | | | | | | | - needs #20168 to make the stuff working I went for this minimal solution because it seems like `compiler.nimble` and `nimsuggest.nimble` are not in use Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* update changelog for #20242, #20091, #20087 (#20288)metagn2022-08-311-1/+9
|
* fixes the regressions caused by the fix for #20107 [backport] (#20287)Andreas Rumpf2022-08-314-1/+4
| | | | * fixes the regressions caused by the fix for #20107 [backport]
* [nimsuggest] fix def call on identifier 2 times on the line (#20228)Ivan Yonchovski2022-08-305-48/+76
| | | | | | | - apparently TLineInfo's implementation of `==` ignores the column. After I fixed the code to use exact TLineInfo comparison I fixed several other issues hidden by that issue. - Replaced `tuple[sym, info]` with `SymInfoPair`
* fix #19600 No error checking on fclose (#19836)Bung2022-08-292-2/+13
| | | | | * fix #19600 No error checking on fclose * add IOError to open
* Implement complex sgn (#20087)Dan Rose2022-08-281-0/+7
| | | Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* fixes #17658; add cert dir for ssl ctx (#19920)ringabout2022-08-282-1/+11
| | | | | | | add cert dir for ssl ctx Co-authored-by: Paul Roberts <pmr@stelo.org.uk> Co-authored-by: sandytypical <43030857+xflywind@users.noreply.github.com> Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* fix `nim md2tex` and `koch pdf` commands (#20280)Andrey Makarov2022-08-282-12/+13
| | | | | * fix `nim md2tex` and `koch pdf` commands * change rst2tex -> md2tex also
* minor updates on manual (#20258)Judd2022-08-271-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * minor updates on manual 1. statement -> keyword: 1. re-phase on the explanation of `import except`: maybe the newer version does not export some of the identifiers; 1. "The original module name is then not accessible" is moved up to the previous paragraph, since it is coupled with the previous paragraph, but not the current one. 1. re-phase on the explanation of _Disabling certain messages_. * Apply suggestions from code review Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> * Update manual.md do not use "()". * Update doc/manual.md Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* Fix auto links to subheader when TOC is present (#20279)Andrey Makarov2022-08-276-104/+165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix links to subheader when TOC is present It was observed (in https://github.com/nim-lang/Nim/pull/20112) that links to 2nd- (and subsequent) -level headings fail if TOC is present, e.g.: ```nim .. contents:: Type relations ============== Convertible relation -------------------- Ref. `Convertible relation`_ ``` The problem here is that links are resolved in `rst.nim` but later `rstgen.nim` fixes ("fixes") anchors to make them unique so that TOC always works (if e.g. there was another sub-section like "Convertible relation"). The solution implemented in this PR is to move that fix-up of anchors into `rst.nim`, so that link resolution could know final anchors. The bug seems to be added in https://github.com/nim-lang/Nim/pull/2332 in 2015, that is it is present in Nim 1.0.
* Update manual.md (#20277)Clay Sweetser2022-08-261-3/+2
|
* Add missing rand(var Rand, Ordinal) overload (#20124)Antonis Geralis2022-08-261-14/+32
| | | | | | | | | | | * Add missing rand(var Rand, Ordinal) overload * Corrected mistake, thanks @metagn Co-authored-by: metagn <metagngn@gmail.com> * Update random.nim Co-authored-by: metagn <metagngn@gmail.com>
* remove `var` for ref parameters in `std/tables` (#20175)ringabout2022-08-251-2/+2
| | | remove `var` from ref parameters; make it consistent
* std/options enables stricteffects (#19441)ringabout2022-08-251-4/+8
|
* provide better error messages for large set (#20207)ringabout2022-08-252-4/+8
| | | Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* remove unused sfProcvar, "procvar" mentions (#20204)metagn2022-08-245-8/+8
| | | refs #12975. doesn't close it because wProcvar isn't removed
* move formatfloat out of system (#20195)ringabout2022-08-2423-176/+201
| | | | | | | | | | | | | | | * move formatfloat out of system * fixes doc * Update changelog.md * careless * fixes * deprecate system/formatfloat * better handling
* fixes nimPreviewSlimSystem; register echoBinSafe for nimPreviewSlimSystem ↵ringabout2022-08-242-0/+8
| | | | | | | (#20194) * register echoBinSafe * add output
* fixes #20227; skip distinct types for genObjConstr [JS backend] (#20229)ringabout2022-08-242-1/+19
| | | fixes #20227; skip distinct types for genObjConstr
* test removing dollar for objects out of system (#20242)metagn2022-08-249-40/+84
| | | | | | | | | | | * test removing dollar for objects out of system * test & fixes * fix bootstrap * use nimPreviewSlimSystem, test stdlib category * fix test
* fixes #20219; ignore comment/empty node in stmtListExpr (#20249)ringabout2022-08-241-0/+4
|
* top-down type inference, implements rfc 149 (#20091)metagn2022-08-2417-199/+599
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * micro implementation of rfc 149 refs https://github.com/nim-lang/RFCs/issues/149 * number/array/seq literals, more statements * try fix number literal alias issue * renew expectedType with if/case/try branch types * fix (nerf) index type handling and float typed int * use typeAllowed * tweaks + const test (tested locally) [skip ci] * fill out more of the checklist * more literals, change @ order, type conversions Not copying the full call tree before the typedesc call check in `semIndirectOp` is also a small performance improvement. * disable self-conversion warning * revert type conversions (maybe separate op later) * deal with CI for now (seems unrelated), try enums * workaround CI different way * proper fix * again * see sizes * lol * overload selection, simplify int literal -> float * range, new @ solution, try use fitNode for nil * use new magic * try fix ranges, new magic, deal with #20193 * add documentation, support templates Co-authored-by: Andreas Rumpf <rumpf_a@web.de>