summary refs log tree commit diff stats
path: root/tests/iter
Commit message (Collapse)AuthorAgeFilesLines
* disable closure iterator changes in #23787 unless `-d:nimOptIters` is ↵metagn2024-09-161-2/+2
| | | | | | | | | | | | | | enabled (#24108) refs #24094, soft reverts #23787 #23787 turned out to cause issues as described in #24094, but the changes are still positive, so it is now only enabled if compiling with `-d:nimOptIters`. Unfortunately the changes are really interwoven with each other so the checks for this switch in the code are a bit messy, but searching for `nimOptIters` should give the necessary clues to remove the switch properly later on. Locally tested that nimlangserver works but others can also check.
* enable closures tests for JS & implement `finished` for JS (#23521)ringabout2024-09-098-9/+29
|
* fixes #24033; Yielding from var fails with pairs and destructuring (#24046)ringabout2024-09-021-0/+16
| | | fixes #24033
* Optimize closure iterator locals (#23787)Yuriy Glukhov2024-07-031-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This pr redefines the relation between lambda lifting and closureiter transformation. Key takeaways: - Lambdalifting now has less distinction between closureiters and regular closures. Namely instead of lifting _all_ closureiter variables, it lifts only those variables it would also lift for simple closure, i.e. those not owned by the closure. - It is now closureiter transformation's responsibility to lift all the locals that need lifting and are not lifted by lambdalifting. So now we lift only those locals that appear in more than one state. The rest remains on stack, yay! - Closureiter transformation always relies on the closure env param created by lambdalifting. Special care taken to make lambdalifting create it even in cases when it's "too early" to lift. - Environments created by lambdalifting will contain `:state` only for closureiters, whereas previously any closure env contained it. IMO this is a more reasonable approach as it simplifies not only lambdalifting, but transf too (e.g. freshVarsForClosureIters is now gone for good). I tried to organize the changes logically by commits, so it might be easier to review this on per commit basis. Some ugliness: - Adding lifting to closureiters transformation I had to repeat this matching of `return result = value` node. I tried to understand why it is needed, but that was just another rabbit hole, so I left it for another time. @Araq your input is welcome. - In the last commit I've reused currently undocumented `liftLocals` pragma for symbols so that closureiter transformation will forcefully lift those even if they don't require lifting otherwise. This is needed for [yasync](https://github.com/yglukhov/yasync) or else it will be very sad. Overall I'm quite happy with the results, I'm seeing some noticeable code size reductions in my projects. Heavy closureiter/async users, please give it a go.
* fixes refc with non-var destructor; cancel warnings (#23156)ringabout2024-02-131-2/+6
| | | fixes https://forum.nim-lang.org/t/10807
* fixes #19977; rework inlining of 'var openarray' iterators for C++ (#23258)ringabout2024-01-261-1/+1
| | | fixes #19977
* fixes #15924; Tuple destructuring is broken with closure iterators (#23205)ringabout2024-01-131-0/+18
| | | fixes #15924
* fixes #22619; don't lift cursor fields in the hook calls (#22638)ringabout2023-09-051-0/+79
| | | | | | | | | | | | | | | | | | | | | | | fixes https://github.com/nim-lang/Nim/issues/22619 It causes double free for closure iterators because cursor fields are destroyed in the lifted destructors of `Env`. Besides, according to the Nim manual > In fact, cursor more generally prevents object construction/destruction pairs and so can also be useful in other contexts. At least, destruction of cursor fields might cause troubles. todo - [x] tests - [x] revert a certain old PR --------- Co-authored-by: zerbina <100542850+zerbina@users.noreply.github.com>
* fix #22548;environment misses for type reference in iterator access n… ↵Bung2023-08-272-0/+43
| | | | | | | | | | | | | (#22559) * fix #22548;environment misses for type reference in iterator access nested in closure * fix #21737 * Update lambdalifting.nim * remove containsCallKinds * simplify
* fix #20891 Illegal capture error of env its self (#22414)Bung2023-08-091-0/+28
| | | | | * fix #20891 Illegal capture error of env its self * fix innerClosure too earlier, make condition shorter
* fixes #22148; std/memfiles.memSlices nesting now fails with memory sa… ↵ringabout2023-06-251-0/+15
| | | | | | | (#22154) * fixes #22148; std/memfiles.memSlices nesting now fails with memory safety capture violation * adds a test case
* fixes #21110; duplicate proc definitions for inline iters (#21136)ringabout2023-06-221-0/+15
| | | fixes #21110; duplicate proc definitions for iters
* `for` loop expression can now have generated `iterator`'s called (#21627)Jason Beetham2023-04-081-0/+54
| | | A for expression now can have a generated iterator, allowing for more composable iterables
* fixes #21306; fixes #20485; don't transform yields in the var section when ↵ringabout2023-03-101-0/+114
| | | | | | | | | | | introducing new local vars [backport: 1.6] (#21489) * fixes #21306; don't transform yields in the var section when introducing new local vars * adds `inVarSection` so the var section in the var section is freshed * use `isIntroducingNewLocalVars` to avoid yield transformations in var sections * fixes comments
* fixes #21043; fixes a named exception in the infixAs expression which ↵ringabout2022-12-121-0/+1
| | | | | | | | | | | generate an implicit uninitialized let statement (#21081) * fixes #21043; fixes a named exception in the infixAs expression which generate an implicit uninitialized let statement * Update compiler/sempass2.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* An unnamed break in a block now gives an `UnnamedBreak` warning (#20901)ringabout2022-11-241-2/+2
| | | | | | | | | | | | | | | | | | | | | * unnamed break in the block now gives an error * bootstrap * fixes * more fixes * break with label * label again * one moee * Delete test5.txt * it now gives a UnnamedBreak warning * change the URL of bump back to the original one
* Fix double defer with break in closureiterators [backport] (#20630)Tanguy2022-10-241-0/+30
| | | | | | | Fix double defer with break in closureiterators Signed-off-by: Tanguy <tanguy@status.im> Signed-off-by: Tanguy <tanguy@status.im>
* defaults to ORC (#19972)ringabout2022-09-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * defaults to Orc * bootstrap using refc * use gc * init orc defines * unregister orc * fix gc * fix commands * add prepareMutation for orc * enable deepcopy for orc * prepareMutation * more fixes * some cases * bug #20081 * partial fixes * partial fixes * fixes command line * more fixes * build Nim with refc * use gc * more fixes * rstore * orc doesn't support threadpool * more shallowCopy * more fixes * fixes unsafeNew * workarounds * small * more fixes * fixes some megatest * tcodegenbugs1 refc * fxies megatest * build nimble with refc * workaround tensordsl tests * replace shallowCopy with move * fixes action * workaround * add todo * fixes important packages * unpublic unregisterArcOrc * fixes cpp * enable windows Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
* remove deprecated type pragma syntax, fix bugs that required it (#20199)metagn2022-09-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Fixed compilation of void closureiters with try stmt (#20138) [backport]Yuriy Glukhov2022-08-031-0/+8
|
* Fix nested finally handling in closureiters [backport] (#19933)Tanguy2022-07-111-0/+75
| | | | | | | | | | | | | | | * Fix nested finally handling in closureiters * Fix CI * review comment * third time the charm * Update compiler/closureiters.nim Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com> Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
* Allow recursive closure iterators (#19939)Tanguy2022-06-301-0/+13
|
* Fix bug in freshVarForClosureIter. Fixes #18474 (#19675) [backport]flywind2022-04-041-0/+18
| | | | | | | | | | * Fix bug in freshVarForClosureIter. Fixes #18474. freshVarForClosureIter was returning non-fresh symbols sometimes. Fixed by making addField return the generated PSym. * remove discardable Co-authored-by: Nick Smallbone <nick@smallbone.se>
* fixes #19575 (#19596) [backport]Andreas Rumpf2022-03-091-0/+23
| | | | | * fixes #19575 * better bugfix
* style usages part one (openarray => openArray) (#19321)flywind2022-01-044-5/+5
| | | | | * style usages (openArray) * revert doc changes
* '[]' can now be used for iterators (#18814)Jason Beetham2021-09-061-0/+14
|
* fixes #14165, fixes #18739, fix the second example of #6269 (#18812)Andreas Rumpf2021-09-061-0/+50
|
* replace wrt with proper word (#18724)flywind2021-08-221-1/+1
| | | | | * what does wrt mean? * clarify
* improve several tests in testament (#18635)Timothee Cour2021-08-081-32/+28
| | | | | | | | | | | * silence error output from template_various.nim * any => auto in tests * avoid showing failed for parseSpec since this is expected behavior in 2 cases: tincludefile.nim, tnav1.nim * enforce InheritFromException * fixup
* Fixes #17849 (#18055) [backport:1.2]Yuriy Glukhov2021-05-301-1/+15
| | | | | | * Fixes #17849 * Update compiler/closureiters.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* follow up #17486 (#17492)flywind2021-03-241-0/+45
| | | | | | | | | * fix nim js cmp fails at CT * follow up #17486 * test more branches * better
* Deprecate TaintedString (#15423)Juan Carlos2021-01-151-1/+1
| | | | Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
* close #1550 add testcase (#16640)flywind2021-01-081-0/+20
|
* testament: error instead of silently ignore invalid targets; remove ↵Timothee Cour2020-12-141-1/+1
| | | | | | | | | | | pointless alias target vs targets; document matrix; DRY (#16343) * testament: error instead of silently ignore invalid targets * s/target/targets/ * fix test; refs #16344 * address comments * Update testament/specs.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* close #2771(add testcase for #2771) (#15932)flywind2020-11-131-0/+21
|
* fixes #15360 [backport:1.2] (#15378)Andreas Rumpf2020-09-211-0/+7
|
* Add test-cases for #12576 and #12523 (#15085)Danil Yarantsev2020-07-271-2/+13
| | | | | * Add a test-case for #12576 * Add a test-case for #12523
* Add testcase for #13815 (#14956)Clyybber2020-07-101-1/+14
|
* fix #13739 (#13742)Arne Döring2020-04-071-0/+27
|
* Revert "fix #13417 (#13712)" (#13728)Andreas Rumpf2020-03-231-21/+0
| | | This reverts commit a5f02cac85281fc2804e910f330f0c11d3c4f77b.
* fix #13417 (#13712)Arne Döring2020-03-221-0/+21
| | | | | * fix #13417 * add test
* Attempt to finish off araq cpp exceptions (#13695)cooldome2020-03-191-1/+3
| | | | | | | | | | | | | | | * config update * disable a questionable test * remove c++ exception handling IDs, new impl doesn't require it anymore * C++ based exceptions finally work * fixes bootstrapping problem in C++ mode * teach GCC it's 2020 now * more bugfixes for C++ based exception handling * apply cooldome's patch * another attempt to enable C++11 * bug fix Co-authored-by: Araq <rumpf_a@web.de> Co-authored-by: cooldome <ariabushenko@bk.ru>
* fixes #12747 [backport] (#13651)cooldome2020-03-161-0/+11
| | | | | | | * fixes #12747 * fix tests * improve code style Co-authored-by: cooldome <ariabushenko@bk.ru>
* fixes #12945 (#12959)cooldome2019-12-241-2/+2
|
* remove unused imports from testsnarimiran2019-11-061-1/+1
|
* expr -> untypedAraq2019-11-051-1/+1
|
* remove deprecated procs (#12535)Andreas Rumpf2019-11-051-1/+1
|
* refactor illegal iterator assignment detection (#12212)Arne Döring2019-10-111-8/+0
| | | | | | * refactor illegal iterator assignment detection * delete crappy test
* Fixed yield in nnkChckRange (#12160)Yuriy Glukhov2019-09-101-0/+14
|
* Support iterators returning lent T (#11938)cooldome2019-08-311-0/+59
| | | | | | | * lent iterators * rebase tests * update changelog * fix comments, more tests