summary refs log tree commit diff stats
path: root/tests/arc
Commit message (Collapse)AuthorAgeFilesLines
...
* fixes #20422; emit nimPrepareStrMutationV2 for toOpenArray to keep th… ↵Andreas Rumpf2023-03-021-0/+12
| | | | | (#21459) fixes #20422; emit nimPrepareStrMutationV2 for toOpenArray to keep the abstraction of mutable strings which have immutable string literals
* fixes #19291; implements `wasMoved` hook (#21303)ringabout2023-03-023-17/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fixes #19291; implements `wasMoved` hook * basics * checkpoint * finish `wasMoved` * add a test for #19291 * add documentation and changelog * work `attachedWasMoved` with generics * fixes optimizer * register `=wasMoved` * handle wasMoved magcis * check another round * some patches * try `op == nil` * nicer * generate `wasMoved` before `destroy` * try again * fixes tests * default wasMoved * Update tests/destructor/tv2_cast.nim * Update tests/destructor/tv2_cast.nim * Update tests/arc/topt_refcursors.nim
* fixes #19795; fixes #11852; fixes #19974; remove parsing pipeline, Nim now ↵ringabout2023-02-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | parses the whole module at one time (#21379) * fixes #19795; remove parse pipeline * isScript * fixes nimscriptapi * don't touch reorder * check script * fixes tests * it seems implicit imports of system cause troubles * access the first child of `nkStmtList` * ignore comments * minor messages * perhaps increases hloLoopDetector * the module is a stmtList, which changes the errors * fixes nimdoc * fixes tlinter * fixes nim secret tests * fixes arc_misc * fixes nim secret tests again * safe; fixes one more test * GlobalError is the root cause too * fixes parsing errors * put emit types to the cfsForwardTypes section * fixes #11852; `{.push checks:off}` now works in procs * disable navigator * fixes nimdoc * add tests for JS * fixes nimsuggest
* fixes #21171; dynamic acyclic refs need to use dyn decRef (#21184)ringabout2022-12-281-0/+77
| | | | | | | * fixes #21171; dyn destructors for acyclic inherited refs * add a test * Update compiler/liftdestructors.nim
* fix #20588 (#21104)Bung2022-12-151-0/+22
|
* fixes #20954; bounchecks for len(toOpenArray()) [backport] (#20956)ringabout2022-12-051-0/+16
| | | | | * bounchecks for len(toOpenArray()) * add a testcase
* rename `std/threads` to `std/typedthreads` (#20850)ringabout2022-11-161-1/+1
| | | | | | | | | * rename `std/threads` to `std/oldthreads` * fixes tests * rename to `typedthreads` * changelog
* fixes a long-standing ARC bug (#20849)ringabout2022-11-161-0/+12
| | | | | * fixes an ARC bug * add a testcase
* support `UncheckedArray[T]` in repr_v2.nim (#20816)Derek 呆2022-11-111-0/+8
|
* fix topt_no_cursor.nim (#20791)Bung2022-11-091-11/+22
|
* Arc global (#20768)Bung2022-11-062-1/+47
| | | | | | | | | | | | | | | * temp * unsure * fix condition * port macro arc runable examples to one file * trigger doc ci * fix Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* Revert "fix arc global variable issues" (#20764)ringabout2022-11-051-1/+1
| | | | | | | * Revert "fix arc global variable issues (#20759)" This reverts commit a3d32a4176539d0829a4e868f4b005a1a71eb7ee. * trigger documentation builds
* fix arc global variable issues (#20759)Bung2022-11-051-1/+1
| | | | | * temp * unsure
* put std/threads under the umbrella of nimPreviewSlimSystem (#20711)ringabout2022-10-311-0/+3
| | | | | | | | | | | * put `std/threads` under the umbrella of `nimPreviewSlimSystem` * add changelog * fixes tests * fixes tests again * fixes tests
* fixes #20572 (#20585)Andreas Rumpf2022-10-171-0/+29
| | | | | * fixes #20572 * added a test case
* 'lock levels' are deprecated, now a noop (#20539)ringabout2022-10-111-1/+1
| | | | | * 'lock levels' are deprecated, now a noop * fixes tests
* closes #9401; add testcase (#20507)ringabout2022-10-061-0/+49
|
* closes #11267; closes #11259; closes #11085; add testcases (#20505)ringabout2022-10-061-0/+12
| | | | | | | * closes #11267; add testcase * closes #11259 * closes #11085
* fixes #19231; newFinalize doesn't work with ORC (#20291)ringabout2022-10-051-0/+18
| | | | | | | | | | | | | | | * fixes #19231; newFinalize doesn't work with ORC first make it pass tests * remove the tables dep creates a binding for finalized procs in order to handle the same symbols. It used to wrongly generat a new symbol id for the same symbol as the encountered one before * refactor and revert #14257 * de indentation * fixes tests; uses instantiated types
* [ARC] fixes #18645; C Compiler error when initializing {.global.} with a ↵ringabout2022-10-031-0/+18
| | | | | | | | | | block (#19953) * fixes #18645; C Compiler error when initializing {.global.} with a block: * arguably cleaner solution Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com> Co-authored-by: Araq <rumpf_a@web.de>
* fixes nim check with orc (#20456)ringabout2022-10-021-0/+7
| | | | | | | | | | | * fixes nim check with orc * fixes tests * add tests * fixes tests * Update tests/arc/t20456.nim
* move widestrs out of system (#20462)metagn2022-10-011-0/+2
| | | | | * move widestrs out of system * fix osproc
* new move analyser2 (#20471)Andreas Rumpf2022-10-012-3/+24
| | | | | | | | * produce better code for closure environment creation * new 'first write' analysis; * scope based move analyser * code cleanup Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* Update message for checking `cast` (#20145)konsumlamm2022-09-282-2/+2
| | | | | * Update message for checking `cast` * Update error messages in tests
* fixes #19457 seqs are not properly updated in loop with ARC/ORC (#19922)ringabout2022-09-282-15/+38
| | | | | | | | | * test CI * fixes #19457 * add comments Co-authored-by: sandytypical <43030857+xflywind@users.noreply.github.com>
* fixes #19401; fixes #19402; rework Forward declaration and finalizer for ORC ↵ringabout2022-09-272-0/+64
| | | | | | | | | | | | | | | | | (#20295) * fixes #19401; fixes #19402; rework Forward declaration and finalizer for ORC * add more tests * give it a name * make more tests * fixes tests * hidden addr for cpp * move code to a function
* Add testcase for bug #20305 (#20323)Antonis Geralis2022-09-131-0/+25
| | | | | | | * add testcase for bug #20305 * Update tcaseobj.nim Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* fixes #19724; don't be aggressive when you infer sink parameters (#20314)Andreas Rumpf2022-09-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | * fixes #19724; don't be aggressive when you infer sink parameters * better logic and updated tests * wip * fixes tests (#20330) * restore tests * try splitPath Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com> * Apply suggestions from code review * Apply suggestions from code review Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
* fixes #20303; wasMoved expressions with side effects for ORC (#20307) [backport]ringabout2022-09-081-0/+13
| | | fixes #20303; wasMoved expressions with side effects
* Add improved Windows UNC path support in std/os (#20281)havardjohn2022-09-031-21/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* [Testament] Extend and document message testing aids (#19996)quantimnot2022-09-012-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [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>
* dec inLoop after exiting the while scope in computeLiveRanges [backport] ↵flywind2022-06-291-0/+45
| | | | | | | (#19918) * dec inLoop after exiting the while scope in computeLiveRanges * add testcase
* fix #19862; make widestrs consistent between refc and orc (#19874) [backport]flywind2022-06-091-0/+13
| | | fix #19862; make widestrs consistent in refc and orc
* fix #19435; don't create TypeBoundOps for tyOpenArray, tyVarargs [backport: ↵flywind2022-04-251-0/+29
| | | | | | | | | 1.6] (#19723) * fix #19435; openArray wronyly registers typebounds * add testcase * don't create TypeBoundOps for tyOpenArray, tyVarargs
* [add testcase] arc problems with recursive types (#19456)flywind2022-03-231-0/+87
| | | | | | | | | | | * [add testcase] arc problems with recursive types close #9650 * do test * expand * Update tests/arc/t9650.nim
* fix #16458; make useNimRtl compile for --gc:orc (#19512)flywind2022-02-111-0/+6
| | | | | * fix #16458; make useNimRtl compile for --gc:orc/arc * fix tests
* don't use a temp for addr [backport: 1.6] (#19503)flywind2022-02-081-0/+22
| | | | | | | | | | | | | * don't use a temp for addr fix #19497 * Update compiler/ccgcalls.nim Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> * add a test Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* deprecate unsafeAddr; extend addr (#19373)flywind2022-01-162-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | * deprecate unsafeAddr; extend addr addr is now available for all addressable locations, unsafeAddr is deprecated and become an alias for addr * follow @Vindaar's advice * change the signature of addr * unsafeAddr => addr (stdlib) * Update changelog.md * unsafeAddr => addr (tests) * Revert "unsafeAddr => addr (stdlib)" This reverts commit ab83c99c507048a8396e636bf22d55fdd84d7d1c. * doc changes; thanks to @konsumlamm Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* style usages part one (openarray => openArray) (#19321)flywind2022-01-042-4/+4
| | | | | * style usages (openArray) * revert doc changes
* fixes an old ARC bug: the produced copy/sink operations don't copy the ↵Andreas Rumpf2021-12-091-0/+15
| | | | hidden type field for objects with enabled inheritance; fixes #19205 [backport:1.6] (#19232)
* fix #18410 (Errors initializing an object of RootObj with the C++ backend) ↵flywind2021-10-311-1/+2
| | | | | | | | | | | | | [backport] (#18836) * fix #18410 * one line comment * typo * typo * cover cpp
* fix #18971 (#19070) [backport:1.6]Derek 呆2021-10-291-0/+10
| | | | since the example code return value from global variable, instead of first argument, the `n.len` is 1 which causes compiler crashes.
* close #17319; add testcase (#18934)flywind2021-10-011-0/+19
|
* alternative to #18918 (#18927)flywind2021-09-301-0/+9
| | | | | * fix #16558 * add testcase
* add testcase for #7308 (#18849)flywind2021-09-141-11/+0
|
* fixes #16246 (#18800)Andreas Rumpf2021-09-041-0/+11
|
* fix #18627(Program segfaults with ARC when using openArray[string]) (#18713)flywind2021-08-191-0/+24
| | | | | | | * fix #18627 * add testcase * rename * another * remove tyVarargs
* make proc names consistent (#18626)flywind2021-08-011-1/+1
| | | | | * rename `endswith` to `endsWith` * rename
* fixes #18579 (#18600)Andreas Rumpf2021-07-271-0/+26
|
* fixes #18565 (#18593)Andreas Rumpf2021-07-271-0/+17
| | | * fixes #18565