summary refs log tree commit diff stats
path: root/tests/stdlib/tsequtils.nim
Commit message (Collapse)AuthorAgeFilesLines
* sequtils: fix errors from `strictFuncs` use (#18998)ee72021-10-161-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Nim 1.4.x compiled the below code without error when using `--experimental:strictFuncs` import std/sequtils type Foo = ref object let foo1 = Foo() let foo2 = Foo() let foos = @[foo1, foo2] let fooTuples = @[(foo1, 1), (foo2, 2)] discard repeat(foo1, 3) discard zip(foos, foos) discard unzip(fooTuples) However, since 2020-12-09, devel Nim produced errors like /tmp/bar.nim(11, 15) template/generic instantiation of `repeat` from here /foo/nim/pure/collections/sequtils.nim(172, 6) Error: 'repeat' can have side effects an object reachable from 'x' is potentially mutated /foo/nim/pure/collections/sequtils.nim(183, 15) the mutation is here /foo/nim/pure/collections/sequtils.nim(183, 15) is the statement that connected the mutation to the parameter This commit reverts some `proc` to `func` changes so that code that: - calls `repeat`, `zip`, or `unzip` - and instantiates them with types containing `ref` can once again be compiled with `strictFuncs`. Otherwise, a user might be forced to drop or alter their `strictFuncs` use when upgrading from Nim 1.4.x, or when writing new code that uses these procedures (at least for now, with the current `strictFuncs` implementation). This commit also adds tests to assert that the remaining funcs in this module can be compiled with `strictFuncs` when used with types containing `ref`. The original batch of `proc` to `func` changes in `sequtils.nim` was in commit 6f57ebae349f, which was partially reverted in 38eb021f8158. See also: https://github.com/nim-lang/Nim/issues/16305
* sequtils now support strict effect tracking (#18782)Andreas Rumpf2021-09-021-0/+5
|
* deprecate `sequtils.delete` and add an overload with saner semantics ↵Timothee Cour2021-07-151-44/+98
| | | | | | | | consistent with `system.delete` (#18487) * deprecate sequtils.delete and add an overload with saner semantics * AssertionDefect => IndexDefect * improve tsequtils * add tests; use splice in js for optimization
* Improve sequtils documentation (#16559)konsumlamm2021-01-041-4/+2
| | | | | | | * Improve sequtils documentation Uncomment assertions in tests * Use present tense
* use doAssert in tests (#16486)flywind2020-12-281-83/+83
|
* make megatest consistent with unjoined tests wrt newlines, honor newlines in ↵Timothee Cour2020-11-281-3/+0
| | | | | | | output spec (#16151) * fix megatest newlines * still allow missing trailing newline for now but in a more strict way than before
* remove isMainModule from json,os,sequtils (#14572)Timothee Cour2020-06-061-0/+460
* move json.isMainModule => tjson * move isMainModule => tos,tsequtils