summary refs log tree commit diff stats
Commit message (Collapse)AuthorAgeFilesLines
* Fix IndexDefect in asyncfile.readLine (#22774)CMD2023-10-011-0/+2
| | | | `readLine` proc in asyncfile module caused IndexDefect when it reached EoF. Now it returns empty string instead.
* copyFile with POSIX_FADV_SEQUENTIAL (#22776)Juan Carlos2023-10-012-0/+9
| | | | | | | | | | | - Continuation of https://github.com/nim-lang/Nim/pull/22769 - See https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_fadvise.html - The code was already there in `std/posix` since years ago. 3 line diff. --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* docs: add another switch example for nimscript (#22772)daylin2023-09-302-0/+3
| | | | | I couldn't find any documentation on the syntax for --hint:X:on|off with `nimscript` except in [this old forum post](https://forum.nim-lang.org/t/8526#55236).
* Make `typeRel` behave to spec (#22261)Ryan McConnell2023-09-304-29/+78
| | | | | | | | | | | | | | | | | | | | | | | | The goal of this PR is to make `typeRel` accurate to it's definition for generics: ``` # 3) When used with two type classes, it will check whether the types # matching the first type class (aOrig) are a strict subset of the types matching # the other (f). This allows us to compare the signatures of generic procs in # order to give preferrence to the most specific one: ``` I don't want this PR to break any code, and I want to preserve all of Nims current behaviors. I think that making this more accurate will help serve as ground work for the future. It may not be possible to not break anything but this is my attempt. So that it is understood, this code was part of another PR (#22143) but that problem statement only needed this change by extension. It's more organized to split two problems into two PRs and this issue, being non-breaking, should be a more immediate improvement. --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #22554; makes `newSeqWith` use `newSeqUninit` (#22771)ringabout2023-09-302-7/+13
| | | fixes #22554
* copyFile with bufferSize instead of hardcoded value (#22769)Juan Carlos2023-09-302-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - `copyFile` allows to specify `bufferSize` instead of hardcoded wrong value. Tiny diff. # Performance - 1200% Performance improvement. # Check it yourself Execute: ```bash for i in $(seq 0 10); do bs=$((1024*2**$i)) printf "%7s Kb\t" $bs timeout --foreground -sINT 2 dd bs=$bs if=/dev/zero of=/dev/null 2>&1 | sed -n 's/.* \([0-9.,]* [GM]B\/s\)/\1/p' done ``` (This script can be ported to PowerShell for Windows I guess, it works in Windows MinGW Bash anyways). # Stats - Hardcoded `8192` or `8000` Kb bufferSize gives `5` GB/s. - Setting `262144` Kb bufferSize gives `65` GB/s (script suggestion). --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #22696; func `strutils.join` for non-strings uses proc `$` which can ↵ringabout2023-09-301-1/+1
| | | | | | | | have side effects (#22770) fixes #22696 partially revert https://github.com/nim-lang/Nim/pull/16281 `join` calls `$` interally, which might introduce a sideeffect call.
* case macro now can be used inside generic. Fixes #20435 (#22752)Juan M Gómez2023-09-302-1/+45
| | | | | | | | | fixes #20435 --------- Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> Co-authored-by: Jake Leahy <jake@leahy.dev> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* deprecates `newSeqUninitialized` replaced by `newSeqUninit` (#22739)ringabout2023-09-294-6/+32
| | | | | | | ref #19727 closes #22586 https://github.com/nim-lang/Nim/issues/22554 needs it to move on. `newSeqUnsafe` can be introduced later.
* fixes #22763; nimcache in nim.cfg uses the relative path to the config file ↵ringabout2023-09-285-3/+16
| | | | | (#22764) fixes #22763
* C++ Adds support for default arg using object construction syntax. Fixes a ↵Juan M Gómez2023-09-282-3/+35
| | | | | | | | | | compiler crash (#22768) `Foo()` below makes the compiler crash. ```nim proc makeBoo(a:cint = 10, b:cstring = "hello", foo: Foo = Foo()): Boo {.importcpp, constructor.} ```
* ref #19727; implement `setLenUninit` for seqsv2 (#22767)ringabout2023-09-282-0/+26
| | | ref #19727
* Removed `localStorage.hasKey` binding (#22766)Thiago2023-09-281-1/+0
| | | | | | | | Doesn't exists anymore. Use `window.localStorage.getItem("key").isNil` instead ![Screenshot from 2023-09-28 07-22-41](https://github.com/nim-lang/Nim/assets/74574275/65d58921-58c7-4a81-9f3b-5faa3a79c4f2)
* Fix #21407 (#22759)Juan Carlos2023-09-282-0/+9
| | | | | | | - Fix #21407 --------- Co-authored-by: Amjad Ben Hedhili <amjadhedhili@outlook.com>
* Documentation only (#22760)Juan Carlos2023-09-271-12/+12
| | | | - Documentation only. - Sometimes newbies try to use Valgrind with RefC etc.
* iNim switch to the official URL (#22762)ringabout2023-09-271-1/+1
| | | ref https://github.com/inim-repl/INim/pull/139
* Documentation only (#22761)Juan Carlos2023-09-271-0/+4
| | | - Mention Bisect bot in Bisect documentation.
* fixes #10542; suppresses varargs conversion warnings (#22757)ringabout2023-09-263-2/+27
| | | | fixes #10542 revives and close #20169
* Add test case for #15351 (#22754)Jake Leahy2023-09-261-0/+5
| | | | | Closes #15351 Stumbled across the issue and found it now works
* fixes stint CI (#22756)ringabout2023-09-261-1/+1
|
* fixes #22706; turn "unknown hint" into a hint (#22755)ringabout2023-09-252-1/+7
| | | fixes #22706
* Make `newStringUninit` available in the VM [backport] (#22748)Amjad Ben Hedhili2023-09-251-9/+12
| | | It's equivalent to `newString`.
* Update Bisect (#22750)Juan Carlos2023-09-251-15/+16
| | | | | | | | | | | | | | | | | - Support multiple OS Bisects (Linux, Windows, MacOS). - Install Valgrind only if needed to speed up non-Valgrind builds. - Valgrind+MacOS bisect support. - Show IR of OK repro code samples. - YAML only, tiny diff. #### New features - Bisect bugs that only reproduce on Windows and OSX. #### See also - https://github.com/juancarlospaco/nimrun-action/pull/10
* Add magic toOpenArrayChar (#22751)SirOlaf2023-09-241-0/+3
| | | | | | Should help with stuff like the checksums package which only takes `openArray[char]` Co-authored-by: SirOlaf <>
* Fix `newStringUninit` not setting the '\0' terminator [backport] (#22746)Amjad Ben Hedhili2023-09-231-2/+6
| | | Causes problems when working with `cstring`s.
* Initialize `newString` in js [backport:1.6] (#22745)Amjad Ben Hedhili2023-09-231-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | ```nim echo newString(8) ``` results in: ``` D:\User\test.js:25 var code_33556944 = c_33556931.toString(16); ^ TypeError: Cannot read properties of undefined (reading 'toString') at toJSStr (D:\User\test.js:25:50) at rawEcho (D:\User\test.js:70:16) at Object.<anonymous> (D:\User\test.js:101:1) at Module._compile (node:internal/modules/cjs/loader:1095:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10) at Module.load (node:internal/modules/cjs/loader:975:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:17:47 Node.js v17.0.1 Error: execution of an external program failed: '"C:\Program Files\nodejs\node.exe" --unhandled-rejections=strict D:\User\test.js' ```
* Make `newStringUninit` available on the js backend [backport] (#22743)Amjad Ben Hedhili2023-09-231-0/+3
|
* fixes #22519; DocGen does not work for std/times on JS backend (#22738)ringabout2023-09-221-3/+3
| | | fixes #22519
* fixes #22246; generate __builtin_unreachable hints for case defaults (#22737)ringabout2023-09-212-4/+8
| | | | fixes #22246 resurrects #22350
* moves `addUnique` to `std/sequtils` (#22734)Juan M Gómez2023-09-212-5/+29
| | | Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Documentation only (#22735)Juan Carlos2023-09-211-12/+13
| | | - Add Atomic ARC to Documentation. Documentation only, tiny diff.
* fixes #22687; js backend - std/bitops/bitsliced throws compile error … ↵ringabout2023-09-212-1/+5
| | | | | | | (#22722) …in typeMasked fixes #22687
* items, pairs and friends now use `unCheckedInc` (#22729)ringabout2023-09-202-26/+35
| | | | | | | | | | | | `{.push overflowChecks: off.}` works in backends. Though it could be implemented as a magic function. By inspecting the generated C code, the overflow check is eliminated in the debug or release mode. ![image](https://github.com/nim-lang/Nim/assets/43030857/49c3dbf4-675e-414a-b972-b91cf218c9f8) Likewise, the index checking is probably not needed.
* removes references to `this` in the `constructor` section (#22730)Juan M Gómez2023-09-201-4/+3
|
* fixes compiler crash by preventing exportc on generics (#22731)Juan M Gómez2023-09-202-3/+14
| | | Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* `constructor` now uses `result` instead of `this` (#22724)Juan M Gómez2023-09-193-37/+13
|
* second test case haul for templates and generics (#22728)metagn2023-09-196-6/+62
| | | | closes #8390, closes #11726, closes #8446, closes #21221, closes #7461, closes #7995
* make parseEnum skip type aliases for enum type sym (#22727)metagn2023-09-192-5/+17
| | | fixes #22726
* Fix `capacity` for const and shallow [backport] (#22705)Amjad Ben Hedhili2023-09-184-8/+8
|
* fixes #22692; ships `ci/funs.sh` (#22721)ringabout2023-09-181-0/+1
| | | fixes #22692
* Add descriptions and examples for `rawProc` and `rawEnv` (#22710)sls10052023-09-181-1/+31
| | | | | | | | | | Add descriptions for `rawProc` and `rawEnv`. See <https://forum.nim-lang.org/t/10485> for more informations. --------- Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> Co-authored-by: Juan Carlos <juancarlospaco@gmail.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Update osfiles.nim, make `moveFile` consider permission on *nix (#22719)litlighilit2023-09-181-1/+1
| | | see https://github.com/nim-lang/Nim/issues/22674
* fixes incorrect cint overflow in system (#22718)ringabout2023-09-182-2/+2
| | | fixes #22700
* fixes `result` requires explicit initialization on noReturn code (#22717)ringabout2023-09-182-1/+28
| | | | | | fixes #21615; fixes #16735 It also partially fixes | #22673, though It still gives 'baseless' warnings.
* prevents declaring a constructor without importcpp fixes #22712 (#22715)Juan M Gómez2023-09-182-2/+22
| | | Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* make expressions opt in to symchoices (#22716)metagn2023-09-1811-64/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | refs #22605 Sym choice nodes are now only allowed to pass through semchecking if contexts ask for them to (with `efAllowSymChoice`). Otherwise they are resolved or treated as ambiguous. The contexts that can receive symchoices in this PR are: * Call operands and addresses and emulations of such, which will subject them to overload resolution which will resolve them or fail. * Type conversion operands only for routine symchoices for type disambiguation syntax (like `(proc (x: int): int)(foo)`), which will resolve them or fail. * Proc parameter default values both at the declaration and during generic instantiation, which undergo type narrowing and so will resolve them or fail. This means unless these contexts mess up sym choice nodes should never leave the semchecking stage. This serves as a blueprint for future improvements to intermediate symbol resolution. Some tangential changes are also in this PR: 1. The `AmbiguousEnum` hint is removed, it was always disabled by default and since #22606 it only started getting emitted after the symchoice was soundly resolved. 2. Proc setter syntax (`a.b = c` becoming `` `b=`(a, c) ``) used to fully type check the RHS before passing the transformed call node to proc overloading. Now it just passes the original node directly so proc overloading can deal with its typechecking.
* Fix #22713: Make size unknown for tyForward (#22714)SirOlaf2023-09-172-4/+15
| | | | | | | Close #22713 --------- Co-authored-by: SirOlaf <>
* implement semgnrc for tuple and object type nodes (#22709)metagn2023-09-163-3/+52
| | | fixes #22699
* Document C++ Initializers (#22704)Juan M Gómez2023-09-151-0/+27
| | | Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Fix Bisect bot (#22703)Juan Carlos2023-09-141-1/+3
| | | | | - https://github.com/nim-lang/Nim/actions/runs/6187256704/job/16796720625#step:4:29 - https://github.com/nim-lang/Nim/issues/22699