summary refs log tree commit diff stats
Commit message (Collapse)AuthorAgeFilesLines
* fixes #23784; don't allow fold paths containing `nkAddr` (#23792)ringabout2024-07-032-1/+158
| | | | | | | fixes #23784 notes that before https://github.com/nim-lang/Nim/pull/23477, it didn't fold paths containing `addr`/`unsafeAddr` because it retained the form of the magic function: `mAddr`.
* This test for issue 9739 never needed to depend upon hash order (#23791)c-blake2024-07-031-2/+1
| | | | | (for `string` or any other key type). Independence is nice to ever change orders. So, change it to just `len` & a `doAssert` like the other test in the same file.
* fixes #23775; injectdestructors now handles discardable statements (#23780)ringabout2024-07-023-2/+27
| | | fixes #23775
* Fixed issues when using `std/parseopt` in miscripts with cmdline = "" (#23785)Gianmarco2024-07-021-3/+15
| | | | | | | Using initOptParser with an empty cmdline (so that it gets the cmdline from the command line) in nimscripts does not yield the expected results. Fixes #23774.
* Fix doc: '\c' '\L' in lexbase.nim (#23781)lit2024-07-011-4/+4
| | | - In lexbase.nim, `\c` `\L` were rendered as `c` `L`.
* refine: strmisc.expandTabs better code structure (#23783)lit2024-07-011-9/+6
| | | | | | | | | After this pr, for a string with just 20 length and 6 `'\t'`, the time reduces by about 1.5%[^t]. Also, the code is clearer than the previous at some places. [^t]: Generally speaking, this rate increases with length. I may test for longer string later.
* fixes #23755; array static inference during overload resolution (#23760)Ryan McConnell2024-07-013-11/+71
| | | | | | | #23755 --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Revert "Document move limitations" (#23778)Andreas Rumpf2024-07-011-1/+0
| | | | | Reverts nim-lang/Nim#23763 Too vague and fear inducing.
* fixes #5091; Ensure we don't wait on an exited process on Linux (#23743)Mark Leyva2024-07-012-0/+20
| | | | | Fixes #5091. Ensure we don't wait on an exited process on Linux
* [backport] fixes #23748; do not skip materializing temporaries for proc ↵Alexander Kernozhitsky2024-06-303-4/+48
| | | | | arguments (#23769) fixes #23748
* Comment out flaky test in tests/stdlib/thttpclient (#23772)Alexander Kernozhitsky2024-06-291-6/+6
| | | | | | | | | ``` $ curl -v http://example.com/404 |& grep 'HTTP/1.1' > GET /404 HTTP/1.1 < HTTP/1.1 500 Internal Server Error ``` So, the test with http://example.com/404 should be disabled, I think.
* Document move limitations (#23763)Juan Carlos2024-06-291-0/+1
| | | | - See https://github.com/nim-lang/Nim/issues/23759#issuecomment-2192123783
* Bumps nimble to entryPoints commit (#23766)Juan M Gómez2024-06-291-1/+1
|
* fixes #23759; rework move for refc (#23764)ringabout2024-06-293-3/+18
| | | fixes #23759
* fixes #9940; genericAssign does not take care of the importC variables in ↵ringabout2024-06-263-3/+34
| | | | | refc [backport] (#23761) fixes #9940
* fixes #23725; Size computations work better when they are correct (#23758)Andreas Rumpf2024-06-261-6/+10
| | | [backport]
* adapt semOpAux to opt-in symchoices (#23750)metagn2024-06-252-1/+38
| | | | | | | | fixes #23749, refs #22716 `semIndirectOp` is used here because of the callback expressions, in this case `db.getProc(...)`, and `semIndirectOp` calls `semOpAux` to type its arguments before overloading starts. Hence it can opt in to symchoices since overloading will resolve them.
* Check for nil in cstringArrayToSeq (#23747)Yuriy Glukhov2024-06-241-0/+2
| | | | | | | | This fixes crashes in some specific network configurations (as `cstringArrayToSeq` is used extensively in `nativesockets`). --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* remove bench action to save resources, which is barely useful (#23753)ringabout2024-06-241-115/+0
|
* Run tests with `nimPreviewHashFarm` on the 3 main back ends. (#23739)c-blake2024-06-221-1/+1
| | | | Assuming CI tests pass (they do for me locally), this should be merged to keep them passing.
* fixes #23742; setLen(0) no longer allocates memory for uninitialized ↵ringabout2024-06-211-2/+8
| | | | | | | | | | strs/seqs for refc (#23745) fixes #23742 Before my PR, `setLen(0)` doesn't free buffer if `s != nil`, but it allocated unnecessary memory for `strs`. This PR rectifies this behavior. `setLen(0)` no longer allocates memory for uninitialized strs/seqs
* [backport] fixes #23711; C code contains backtick`gensym (#23716)ringabout2024-06-196-7/+40
| | | fixes #23711
* Add Farm Hash conditioned upon `nimPreviewHashFarm` as 64-bit `Hash` (#23735)c-blake2024-06-193-25/+199
| | | | | | | | | | | | | | | | | | | | | | | | | Unlike present Nim this actually fills `Hash` for `string` & related. For the curious, note that `hashData` remains the aboriginal Nim string hasher & `import hashes {.all.}` allows simultaneous test/time of {orig, murmur, farm} on your favorite CPU & back end compiler. Update tests also conditioned upon `nimPreviewHashFarm` so they should pass either with or without that `define` on. In `--jsbigint=on` mode, only the lower 32-bits of `Hash` match nimvm & run-time values because `type Hash = int` and on JS int=int32, not int64 as for 64-bit Nim platforms. Due to the matching, `const` Table should match run-time `Table` on all platforms. To operate in `--jsbigint=off` mode is feasible but needs much "double precision mul/xor/ror/shr-arithmetic"-style work. That is distracting & also of questionable value since JS added BigInt in 2018, ringabout added Nim support for it in 2021 & `nimPreviewHashFarm` is unlikely to swap from an opt-in to an opt-out default before 2025..2026 which will have given a backward looking time window of 7..8 years for deployment platforms - reasonably generous. Add a changelog entry for 2.2.
* adds a define nimHasJsNoLambdaLifting so we can use it in the config for ↵ringabout2024-06-191-0/+1
| | | | compatibility (#23736)
* IC: use tables instead of huge seqs because the compiler can create l… ↵Andreas Rumpf2024-06-185-49/+67
| | | | | (#23737) …ots of dummy syms and types
* fixes #23732, os.sleep(-1) now returns immediately (#23734)lit2024-06-181-0/+3
| | | fixes #23732
* disable dnsclient because it is fragile (#23728)ringabout2024-06-181-1/+1
| | | | | | | | | | | | | | | ``` Unhandled exception: /home/runner/work/Nim/Nim/pkgstemp/dnsclient/tests/test1.nim(28, 3) `rr.strings == @["dnsclient.nim"]` [AssertionDefect] [FAILED] query TXT [OK] query MX [OK] query CNAME [OK] query SRV Error: execution of an external program failed: '/home/runner/work/Nim/Nim/pkgstemp/dnsclient/tests/test1' Tip: 2 messages have been suppressed, use --verbose to show them. tools.nim(36) doCmd Error: Execution failed with exit code 1 ... Command: /home/runner/work/Nim/Nim/bin/nim c --noNimblePath -d:NimblePkgVersion=0.3.4 --hints:off -r --path:. /home/runner/work/Nim/Nim/pkgstemp/dnsclient/tests/test1 ```
* ignore uninstantiated static on match to base type [backport:2.0] (#23731)metagn2024-06-182-2/+10
| | | | | | | | | | | | | | | | | | | | | fixes #23730 Since #23188 the compiler errors when matching a type variable to an uninstantiated static value. However sometimes an uninstantiated static value is given even when only a type match is being performed to the base type of the static type, in the given issue this case is: ```nim proc foo[T: SomeInteger](x: T): int = int(x) proc bar(x: static int): array[foo(x), int] = discard discard bar(123) ``` To deal with this issue we only error when matching against a type variable constrained to `static`. Not sure if the `q.typ.kind == tyGenericParam and q.typ.genericConstraint == tyStatic` check is necessary, the code above for deciding whether the variable becomes `skConst` doesn't use it.
* Fix NIM_STATIC_ASSERT_AUX being redefined on different lines (#23729)fakuivan2024-06-181-4/+8
| | | | | | | | | fixes #17247 This generates a new NIM_STATIC_ASSERT_AUX variable for each line that NIM_STATIC_ASSERT is called from. While this can solve all existing issues in the current code base, this method is not effective for multiple asserts on a single line.
* implement `legacy:jsNoLambdaLifting` for compatibility (#23727)ringabout2024-06-176-19/+76
|
* fixes #20048; fixes #15746; don't sink object fields if it's of openarray ↵ringabout2024-06-153-1/+24
| | | | | | type (#23608) fixes #20048 fixes #15746
* Fix example code in Nim manual that cannot be compiled without error (#23722)Tomohiro2024-06-151-1/+1
|
* ref #20653; fixes chronos empty case branches (#23706)ringabout2024-06-141-7/+11
| | | | | | | | | | | | | | | ref #20653 ```nim Error* = object case kind*: ErrorType of ErrorA: discard of ErrorB: discard ``` For an object variants without fields, it shouldn't generate empty brackets for default values since there are no fields at all in case branches.
* fixes a long standing bug with varargs type inference [backport] (#23720)Andreas Rumpf2024-06-141-1/+1
|
* Fix non-exported `memfiles.setFileSize` to be able to shrink files on posix ↵c-blake2024-06-141-36/+30
| | | | | | | | | | | | | | via `memfiles.resize` (#23717) Fix non-exported `setFileSize` to take optional `oldSize` to (on posix) shrink differently than it grows (`ftruncate` not `posix_fallocate`) since it makes sense to assume the higher address space has already been allocated there and include the old file size in the `proc resize` call. Also, do not even try `setFileSize` in the first place unless the `open` itself works by moving the call into the `if newFileSize != -1` branch. Just cosmetics, also improve some old 2011 comments, note a logic diff for callers using both `mappedSize` & `newFileSize` from windows branch in case someone wants to fix that & simplify code formatting a little.
* nrvo for embedded importc'ed types (#23708)ringabout2024-06-121-3/+6
|
* fixes #22927; no test case extractable [backport] (#23707)Andreas Rumpf2024-06-121-11/+23
|
* fixes #23513, parseutils.nim: parseInt's doc example. (#23561)lit2024-06-121-8/+12
| | | | | | | | | | fixes #23513 Also, the old `runnableExample` is just a copy of `proc parseInt(openArray[char], var int, int)` variant (in Line 1000). --------- Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* [backport] fixes #23690; SIGSEGV with object variants and RTTI (#23703)ringabout2024-06-112-3/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fixes #23690 ```nim dest.`:state` = src.`:state` var :tmp_553651276 = dest.e1.a `=wasMoved`(dest.e1.a) dest.e1.a.kind = src.e1.a.kind case dest.e1.a.kind of 0: dest.e1.a.a = src.e1.a.a of 1: `=copy`(dest.e1.a.c, src.e1.a.c) case :tmp_553651276.kind of 0: of 1: `=destroy`(:tmp_553651276.c) ``` `dest.e1.a.kind = src.e1.a.kind` changes the discrimant but it fails to clear the memory of `dest.e1.a`. Before using hooks for copying, we need to clear the dest, e.g. `=wasMoved(dest.e1.a.c)`. ```nim dest.`:state` = src.`:state` var :tmp_553651276 = dest.e1.a `=wasMoved`(dest.e1.a) dest.e1.a.kind = src.e1.a.kind case dest.e1.a.kind of 0: `=wasMoved`(dest.e1.a.a) dest.e1.a.a = src.e1.a.a `=wasMoved`(dest.e1.a.b) of 1: `=wasMoved`(dest.e1.a.c) `=copy`(dest.e1.a.c, src.e1.a.c) case :tmp_553651276.kind of 0: of 1: `=destroy`(:tmp_553651276.c) ```
* fixes #22398; [backport] (#23704)Andreas Rumpf2024-06-102-9/+32
|
* Fixes #23695: On Linux, "nimsuggest" crashes if Nim is installed in /usr/bin ↵Juan M Gómez2024-06-101-16/+2
| | | | | and the library in /usr/lib/nim (#23697) (Not tested)
* fixes #23445; fixes #23418 [backport] (#23699)Andreas Rumpf2024-06-093-1/+40
|
* nimsuggest v3+ handles unknownFile (#23696)Juan M Gómez2024-06-081-5/+2
|
* remove pkg "pylib" (#23691)ringabout2024-06-071-1/+0
| | | https://github.com/Yardanico/nimpylib is 404 now
* fixes #23354; [backport] (#23685)Andreas Rumpf2024-06-072-0/+20
|
* fixes #22672; Destructor not called for result when exception is thrown (#23267)ringabout2024-06-065-5/+51
| | | fixes #22672
* fixes #22510 (#23100)Andreas Rumpf2024-06-064-27/+187
|
* make `std/options` compatible with strictdefs (#23675)ringabout2024-06-051-6/+6
|
* fixes #5901 #21211; don't fold cast function types because of gcc 14 (#23683)ringabout2024-06-052-2/+8
| | | | | | | | | follow up https://github.com/nim-lang/Nim/pull/6265 fixes #5901 fixes #21211 It causes many problems with gcc14 if we fold the cast function types. Let's check what it will break
* fix noreturn/implicit discard check logic (#23681)metagn2024-06-056-74/+195
| | | | | | | | | | | | | | | | | | | | | | | | | | fixes #10440, fixes #13871, fixes #14665, fixes #19672, fixes #23677 The false positive in #23677 was caused by behavior in `implicitlyDiscardable` where only the last node of `if`/`case`/`try` etc expressions were considered, as in the final node of the final branch (in this case `else`). To fix this we use the same iteration in `implicitlyDiscardable` that we use in `endsInNoReturn`, with the difference that for an `if`/`case`/`try` statement to be implicitly discardable, all of its branches must be implicitly discardable. `noreturn` calls are also considered implicitly discardable for this reason, otherwise stuff like `if true: discardableCall() else: error()` doesn't compile. However `endsInNoReturn` also had bugs, one where `finally` was considered in noreturn checking when it shouldn't, another where only `nkIfStmt` was checked and not `nkIfExpr`, and the node given for the error message was bad. So `endsInNoReturn` now skips over `skipForDiscardable` which no longer contains `nkIfStmt`/`nkCaseStmt`/`nkTryStmt`, stores the first encountered returning node in a var parameter for the error message, and handles `finally` and `nkIfExpr`. Fixing #23677 already broke a line in `syncio` so some package code might be affected.