summary refs log tree commit diff stats
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Add linux/loongarch64 support in 'compiler/installer.ini' (#23672)qiangxuhui2024-06-041-1/+1
| | | | | The files(like `build/build.sh`)generated by the command `koch csource` do not contain complete `linux/loongarch64` support. This patch will fix it.
* fixes openarray hoist with gcc 14 (#23647)ringabout2024-06-042-2/+18
| | | | | | | blocks https://github.com/nim-lang/Nim/pull/23673 --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* [backport] test more packages (#23671)Miran2024-06-031-0/+13
| | | | These packages are some of the dependencies of Nimbus with shorter testing times.
* rework ctypes with gcc 14 (#23636)ringabout2024-06-021-0/+5
|
* improve view types for jsgen; eliminate unnecessary copies of view types ↵ringabout2024-06-022-2/+21
| | | | (#23654)
* #Fixes #23657 C++ compilation fails with: 'T1_' was not declared in t… ↵Juan M Gómez2024-06-025-24/+103
| | | | | (#23666) …his scope
* fixes#23665; rework spawn with gcc 14 and fixes other tests (#23660)ringabout2024-06-023-3/+16
| | | fixes #23665
* fixes #22798; Duplicate libraries linker warning (i.e., '-lm') on macOS (#23292)ringabout2024-06-022-2/+2
| | | | | | | | | | | | | | | fixes #22798 Per https://stackoverflow.com/questions/33675638/gcc-link-the-math-library-by-default-in-c-on-mac-os-x and https://stackoverflow.com/questions/30694042/c-std-library-dont-appear-to-be-linked-in-object-file > There's no separate math library on OSX. While a lot of systems ship functions in the standard C math.h header in a separate math library, OSX does not do that, it's part of the libSystem library, which is always linked in. required by https://github.com/nim-lang/Nim/pull/23290
* fixes #23663; Add hash() for Path (#23664)ringabout2024-05-312-6/+17
| | | fixes #23663
* remove winim from important packages; since CI doesn't check windows ↵ringabout2024-05-301-1/+1
| | | | | platform (#23661) Cannot compile on Linux reliably
* Treat CJK Ideographs as letters in `isAlpha()` (#23651)Alexander Kernozhitsky2024-05-293-1982/+1995
| | | | | | | | | | | | | | | | | Because of the bug in `tools/parse_unicodedata.nim`, CJK Ideographs were not considered letters in `isAlpha()`, even though they have category Lo. This is because they are specified as range in `UnicodeData.txt`, not as separate characters: ``` 4E00;<CJK Ideograph, First>;Lo;0;L;;;;;N;;;;; 9FEF;<CJK Ideograph, Last>;Lo;0;L;;;;;N;;;;; ``` The parser was not prepared to parse such ranges and thus omitted almost all CJK Ideographs from consideration. To fix this, we need to consider ranges from `UnicodeData.txt` in `tools/parse_unicodedata.nim`.
* revert #23436; remove workaround (#23653)ringabout2024-05-281-2/+0
| | | revert #23436
* fixes #23635; tasks.toTask Doesn't Expect a Dot Expression (#23641)ringabout2024-05-272-4/+56
| | | | | | | fixes #23635 --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #22852; fixes #23435; fixes #23645; SIGSEGV when slicing string or ↵ringabout2024-05-272-5/+10
| | | | | | | | | | | | | | | | | | seq[T] with index out of range (#23279) follow up https://github.com/nim-lang/Nim/pull/23013 fixes #22852 fixes #23435 fixes #23645 reports rangeDefect correctly ```nim /workspaces/Nim/test9.nim(1) test9 /workspaces/Nim/lib/system/indices.nim(116) [] /workspaces/Nim/lib/system/fatal.nim(53) sysFatal Error: unhandled exception: value out of range: -2 notin 0 .. 9223372036854775807 [RangeDefect] ```
* Handle arbitrarily long symlink target in `expandSymlinks()` (#23650)Alexander Kernozhitsky2024-05-271-8/+10
| | | | | | | | | | | | | | | For now, `expandSymlinks()` can handle only symlinks with lengths up to 1024. We can improve this logic and retry inside a loop with increasing lengths until we succeed. The same approach is used in [Go](https://github.com/golang/go/blob/377646589d5fb0224014683e0d1f1db35e60c3ac/src/os/file_unix.go#L446), [Rust](https://github.com/rust-lang/rust/blob/785eb65377e5d7f8d8e8b82ede044212bbd2d76e/library/std/src/sys/pal/unix/fs.rs#L1700) and [Nim's `getCurrentDir()`](https://github.com/nim-lang/Nim/blob/devel/lib/std/private/ospaths2.nim#L877), so maybe it's a good idea to use the same logic in `expandSymlinks()` also.
* Prevent font flashing in the docs (#23622)Nils Lindemann2024-05-2713-39/+52
| | | | | | | | | | ... by moving the Google font includes near the top of the head. By including them as early as possible, they are known, when the browser starts rendering the body. Test it by making the change manually in `doc/html/system.html` and then press ctrl+f5 (reload without cache). This removes the font flashing. Tested in Chrome and Firefox.
* closes #13426; adds a test case (#23642)ringabout2024-05-241-0/+87
| | | closes #13426
* Updates nimble (#23601)Juan M Gómez2024-05-231-1/+3
|
* Skip tyAlias inside semTypeTraits in case a concept accidently emits one ↵Jason Beetham2024-05-232-1/+12
| | | | (#23640)
* Minor refactoring (#23637)Andreas Rumpf2024-05-231-17/+15
|
* fixes `reifiedOpenArray`; `nkHiddenStdConv` is PathKinds1 not PathKinds0 ↵ringabout2024-05-221-2/+8
| | | | (#23633)
* fixes #23627; Simple destructor code gives invalid C (#23631)ringabout2024-05-212-8/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | fixes #23627 ```nim type TestObj = object of RootObj TestTestObj = object of RootObj testo: TestObj proc `=destroy`(x: TestTestObj) = echo "Destructor for TestTestObj" proc testCaseT() = echo "\nTest Case T" let tt1 {.used.} = TestTestObj(testo: TestObj()) ``` When generating const object fields, it's likely that we need to generate type infos for the object, which may be an object with custom hooks. We need to generate potential consts in the hooks first. https://github.com/nim-lang/Nim/pull/20433 changed the semantics of initialization. It should evaluate`BracedInit` first.