Commit Graph

5225 Commits

Author SHA1 Message Date
orthoplex
cfee71e779 fixed colorNames sorting mistake (#19125) [backport]
(cherry picked from commit 528ef6c218)
2021-11-17 09:25:47 +01:00
Andreas Rumpf
575450dfec fixes another effect inference bug [backport:1.6] (#19100)
* fixes another effect inference bug [backport:1.6]

(cherry picked from commit fce89cb60a)
2021-11-11 16:15:51 +01:00
Andrey Makarov
162b07d72c fix parsesql.treeRepr when nil is in input (#18974)
* fix parsesql.treeRepr when nil is in input

* return newNode(nkNone) as default value, not nil
2021-10-17 05:38:07 +02:00
ee7
3b1a601fe1 sequtils: fix errors from strictFuncs use (#18998)
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 6f57ebae34, which was partially reverted in 38eb021f81.

See also: https://github.com/nim-lang/Nim/issues/16305
2021-10-16 11:25:05 +02:00
flywind
e2b19bb2de remove deprecated stuffs from std/times (#18937) 2021-10-13 14:58:31 +02:00
quantimnot
19774a72e7 Fixed strictFuncs support for std/pegs (#18951)
* Fixed `strictFuncs` support for `std/pegs`

Enabled `std/pegs` in the `strictFuncs` import test.

Fixes #18057
Fixes #16892
See #18111

* Rebased from `devel`

* Conditionally compile `std/pegs` in `koch`

This is for supporting `csources` bootstrap.

Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
2021-10-07 12:16:58 +02:00
flywind
f8d6a53227 typo [backport] (#18967) 2021-10-07 12:01:27 +02:00
Andreas Rumpf
f1f1e85ec6 fixes #18954 (#18955) 2021-10-05 12:29:59 +02:00
flywind
e7bac91773 rename nimEnableHashRef [backport] (#18941)
* rename nimEnableHashRef [backport]
* Apply suggestions from code review

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2021-10-04 21:28:13 +02:00
quantimnot
f017eadc97 Add support for strictEffects to std/pegs (#18949)
* Add support for `strictEffects` to `std/pegs`

* Fixed support of older Nim versions

Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
2021-10-04 21:27:13 +02:00
flywind
2aeac26f08 correct licence header (#18935)
* rename licence

* spaces
2021-10-01 13:57:06 +02:00
Jonas Schubert Erlandsson
f35e9a5752 Adds source to single tags list (#18920) 2021-09-29 18:14:31 +02:00
Timothee Cour
f061971a9b envPairs works in vm, nims (#18615)
* envPairs works in vm, nims

* fixup
2021-09-29 09:32:39 +02:00
flywind
4adada0d80 fix a typo (rename temporal to temporary (#18892) [backport] 2021-09-24 16:34:12 +02:00
Andreas Rumpf
5d315ebcc2 ported Nim to proprietary CrossOS [backport] (#18889) 2021-09-24 13:24:41 +02:00
flywind
ee9795f76f fix #18844 (#18851) 2021-09-20 09:50:20 +02:00
Andreas Rumpf
3241df2a13 fixes #18858 [backport] (#18868)
* fixes #18858 [backport]

* ensure async tests work with --experimental:strictEffects [backport]

* ensure async tests work with --experimental:strictEffects [backport]
2021-09-19 23:35:50 +02:00
flywind
1f68f71ec2 [minor] fix docs (#18834) 2021-09-11 11:33:52 +02:00
Juan Carlos
0ef830577b distros.foreignDeps made public (#18830)
* Deprecate distros.echoForeignDeps

* Deprecate distros.echoForeignDeps

* https://github.com/nim-lang/Nim/pull/18830#discussion_r705364162

* https://github.com/nim-lang/Nim/pull/18830#discussion_r705364162
2021-09-10 10:20:32 +02:00
Jacek Sieka
0635697a89 Document -d:async_backend flag (#18700)
* Document `-d:asyncBackend` flag

Since libraries may want to support multiple async backends, it's useful
to standardize the way this is done, so as to simplify usage of any
async backend within the ecosystem.

A similar text is being added to chronos here:
https://github.com/status-im/nim-chronos/pull/216

See also https://github.com/status-im/nim-chronos/issues/207

* typos, add none

* Update lib/pure/asyncdispatch.nim

* Update lib/pure/asyncdispatch.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-09-03 14:20:57 +02:00
Andreas Rumpf
69cabaa81c sequtils now support strict effect tracking (#18782) 2021-09-02 14:35:25 +02:00
Tomohiro
7c8ea490a2 Fix initrand to avoid random number sequences overlapping (#18744)
* Fix initrand to avoid random number sequences overlapping

* Minor fix

* Fix compile error on js backend

* Disable new test for js backend

* Minor fix

* tempfiles module uses random.initRand()

* Remove unused module import from lib/std/tempfiles.nim

* Initialize baseState in initRand()

* Run tests/stdlib/trandom.nim from tests/test_nimscript.nims

* baseState is initialized only with sysrand.urandom and quit if failed

* Add comments
2021-09-02 14:12:14 +02:00
Andreas Rumpf
e0ef859130 strict effects (#18777)
* fixes #17369
* megatest is green for --cpu:arm64
* docgen output includes more tags/raises
* implemented 'effectsOf' 
* algorithm.nim: uses new effectsOf annotation
* closes #18376
* closes #17475
* closes #13905
* allow effectsOf: [a, b]
* added a test case
* parameters that are not ours cannot be declared as .effectsOf
* documentation
* manual: added the 'sort' example
* bootstrap with the new better options
2021-09-02 12:10:14 +02:00
konsumlamm
f02de25ca1 Fix #15150 (#18730) 2021-08-31 08:14:05 +02:00
flywind
9674ff4361 make deprecated message better (#18737) 2021-08-23 11:13:10 -07:00
konsumlamm
2d84f6e7c8 Fix #18718 (#18731)
Update tests
2021-08-23 00:13:39 +02:00
Tomohiro
373bbd9bb4 Add ceilDiv to math (#18596)
* Use assert in runnableExamples and improve boundary check
* Add more tests for ceilDiv
* Fix comment in ceilDiv
* Calling ceilDiv with int type T such like sizeof(T) > 8 is error
2021-08-19 11:35:40 +02:00
Emery Hemingway
5fd150b7f7 asynchttpserver: ipv6 support (#18706)
Fix #18705
2021-08-18 14:25:25 +02:00
Juan Carlos
b3e077863a Documentation only, Terminal (#18696)
Add simple progress bar example to terminal module
2021-08-14 20:51:41 -04:00
Timothee Cour
52cc0a82ca fix #18692 AsyncHttpServer was hanging because client.close was not called (#18693) 2021-08-14 02:13:30 -07:00
flywind
883c04d444 don't use space after proc names (#18681) 2021-08-12 20:57:12 -04:00
Timothee Cour
5c1304a418 fix #18670 quoteShellCommand, quoteShell, quoteShellWindows on windows (#18671) 2021-08-12 16:50:08 +02:00
RSDuck
d0dd923acf Switch maintanance (#18668)
* Fix and improve Nintendo Switch support

* Document the necessity for nimAllocPagesViaMalloc

* update changelog

* Use --gc:orc in examples
2021-08-11 08:54:49 +02:00
Timothee Cour
8ce782d463 Add optional recursive arg to distinctBase (v2) (#18659)
* Add optional recursive arg to distinctBase
* Add docs and examples

Co-authored-by: ALANVF <alan.invents@gmail.com>
2021-08-09 08:51:39 +02:00
Timothee Cour
988c02b7cb renamed: lib/std/private/vmutils.nim -> lib/std/private/bitops_utils.nim to avoid confusion with unrelated std/vmutils (#18660) 2021-08-08 19:24:45 -07:00
Christian Ulrich
0d3af5454b Only allow IPv4 literals in strict form (#18656)
* Only allow IPv4 literals in strict form

The strict form as defined in RFC 6943, section 3.1.1 only allows the dotted
form ddd.ddd.ddd.ddd of IPv4 literals, where ddd is a one to three digit decimal
number between 0 and 255. Until now octal numbers (with a leading zero) were
interpreted as decimal numbers which has security implications, see
CVE-2021-29922 and CVE-2021-29923.

* Update lib/pure/net.nim

Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
2021-08-08 19:11:07 +01:00
Kyle Brown
eb19db6595 Nim pretty and add void (#18652)
* pretty and add void

* distro fixup

* Update lib/pure/distros.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

* tab to space

* requested change to be cleaner

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2021-08-08 19:30:51 +02:00
Kyle Brown
499d4690fb Add Artix to distro list (#18629) 2021-08-02 03:38:15 -04:00
flywind
c6fadb1799 [minor] reduce substr (#18611)
* minor

* correct

* unify the type of addrLen

* Update lib/packages/docutils/rstgen.nim
2021-07-30 09:32:00 +02:00
Timothee Cour
6b3c77e7f4 Remove tracking of environment from osenv.nim v2 (#18575)
* Remove unnecessary environment tracking

* try to fix windows

* fix delEnv

* make putEnv work on windows even with empty values; improve tests: add tests, add js, vm testing

* [skip ci] fix changelog

Co-authored-by: Caden Haustein <code@brightlysalty.33mail.com>
2021-07-29 23:05:26 +02:00
Miran
e616675c41 various small documentation improvements (#18602) 2021-07-28 14:31:13 +02:00
Timothee Cour
4c1202972a fix #17072: add times.dateTime with ISO 8601 order (#18590)
* fix #17072: add times.dateTime with ISO 8601 order

* address comments
2021-07-28 06:38:19 +02:00
konsumlamm
22776c410a Update documentation for dynlib (#17356)
* Update documentation for dynlib

* Apply suggestions

* Improve error handling in example
2021-07-26 19:15:21 -04:00
Antonis Geralis
d4c3a09286 optimize for the non-throwing case (#18587) 2021-07-26 15:22:42 +02:00
Juan Carlos
e08ec0c674 Documentation only, Sugar arrow and semicolons (#18574)
* Document that sugar arrow do not support semicolon as argument separator
2021-07-25 18:07:43 +02:00
Timothee Cour
76f74fae88 std/random: fix overflow bugs; fixes #16360; fixes #16296; fixes #17670 (#18456) 2021-07-23 13:41:16 +02:00
Caden Haustein
f62f4159f8 Replace calls to putenv with setenv (#18530)
* Replace calls to C `putenv` with C `setenv` to remove possible memory leaks

* Add test of correct behaviour on invalid input

* Fix style in tests/stdlib/tos.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* Update tests/stdlib/tos.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* Update tests/stdlib/tos.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* Add comment with bug number to tests/stdlib/tos.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* Fix possible msvc arch issues

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-07-23 10:04:29 +02:00
itsumura-h
58080525a1 add [1..2] for JArray (#18525)
* add [1..2] for JArray
* fix BackwardsIndex to int
* fix for BackwardsIndex
* fix for assert node kind check
* fix variable name
* Update lib/pure/json.nim
* fix for when x.a is BackwardsIndex

Co-authored-by: itsumura-h <dumblepy@mail.com>
Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
2021-07-21 15:03:48 +02:00
IterableTrucks
880353c0ad complement notes of two doc strings of tables module (#18527)
* complement notes of two doc strings warning the deprecated  procedure's side effect

* Update lib/pure/collections/tables.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

* Update lib/pure/collections/tables.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: BillyZee <billyzee@localhost.localdomain>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2021-07-21 14:13:50 +02:00
flywind
a8b3e7c059 follow up #18517 (#18537)
* follow up #18517

* Update lib/pure/os.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* Update lib/pure/os.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-07-20 15:32:55 +02:00