Commit Graph

19777 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
Ryan Oldenburg
1090b0c4af Remove tlsEmulation enabled from Windows + GCC config (#19119) [backport:1.6]
This flag has a very significant performance impact on programs compiled with --threads:on. It is also apparently not needed anymore for standard circumstances. Can we remove the config? See https://github.com/nim-lang/Nim/issues/18146#issuecomment-876802676 for discussion and perf impact. [backport:1.6]

(cherry picked from commit 77b696c2c9)
2021-11-11 16:16:45 +01:00
Andreas Rumpf
3f6de926f0 fixes #14470 [backport:1.2] (#19115)
(cherry picked from commit 15157d06c3)
2021-11-11 16:16:31 +01:00
Andrey Makarov
13343180b8 fix nimindexterm in rst2tex/doc2tex [backport] (#19106)
* fix nimindexterm (rst2tex/doc2tex) [backport]

* Add support for indexing in rst

(cherry picked from commit 997ccc5889)
2021-11-11 16:16:23 +01:00
Andreas Rumpf
95dce90467 fixes #19011 [backport:1.6] (#19114)
(cherry picked from commit 6ff61766da)
2021-11-11 16:16:11 +01:00
Andreas Rumpf
f85e09633d fixes #19013 [backport:1.6] (#19111)
* fixes #19013 [backport:1.6]

* added test case

(cherry picked from commit b7c66ce860)
2021-11-11 16:16:03 +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
Andreas Rumpf
6a2babac47 fixes #19078 [backport] (#19090)
(cherry picked from commit 9d51197aa4)
2021-11-03 15:06:53 +01:00
haxscramper
a6e192f020 [FIX] Do not break formatted string line (#19085) [backport]
Otherwise, compiler produces broken error message - `$1` is not interpolated

`Error: The $1 type doesn't have a default value. The following fields must be initialized: importGraph.`

(cherry picked from commit 4c510d5577)
2021-11-03 15:06:40 +01:00
flywind
233c6e9fb3 fix #18410 (Errors initializing an object of RootObj with the C++ backend) [backport] (#18836)
* fix #18410

* one line comment

* typo

* typo

* cover cpp

(cherry picked from commit 2f730afe9e)
2021-11-03 15:06:31 +01:00
Derek 呆
97286db546 fix #18971 (#19070) [backport:1.6]
since the example code return value from global variable, instead
of first argument, the `n.len` is 1 which causes compiler crashes.

(cherry picked from commit f755e452d2)
2021-11-03 15:06:24 +01:00
Timothy Alexander
1ac029c0f6 Fix #19052; [backport:1.6.0] (#19053)
* Fix #19052; [backport:1.6.0]

Adds a compile flag to avoid a getrandom syscall, fixing #19052.

This is neccesary when the getrandom syscall is missing, as noted in #19052, particularly in kernel versions < 3.17 when getrandom was introduced. Specifically relevant is this is missing from kernel 3.10, which is the supported kernel throughout RHEL 7 and CentOS 7, which is widely used at many organizations. Without this, versions of nim that include sysrand (i.e. versions >= 1.6.0) will not compile without modification, however with this change a compile flag may be used to fall back using /dev/urandom as done with any unknown Posix OS (preferred here as a fallback since it already supplies a cryptographically secure PRNG and existing code deals with entropy pool init, etc).

The change is placed behind a compile flag, as discussed in github ticket #19052 (summed up here):
* First, I can't seem to catch that a importc such as SYS_getrandom is declared without using it (the declared proc returns true, but compiler throws an undeclared identifier flag when referencing it).
* Second, it seemed preferable to be behaviorally explicit vs implicit when considering this is intended to be a cryptographically secure PRNG.
* Third, if I intend to compile on a kernel >= 3.17 while running the binary on at least one system < 3.17, I'll want to be able to target this without relying on a compile time determination if the getrandom syscall is available.

* Documenting compile flag for -d:nimNoGetRandom and adding changelog entry
Related to #19052 and comments in PR #19053. Also created a new changelog file since none currently exists.

Co-authored-by: Timothy Alexander <talexander@midwestlabs.com>
(cherry picked from commit dde556665a)
2021-11-03 15:05:32 +01:00
Andreas Rumpf
b18b636ea6 use two underscores for easy demangling [backport:1.6] (#19028)
(cherry picked from commit 1a45da9150)
2021-10-27 11:06:42 +02:00
narimiran
ac89e06c6e bump NimVersion to 1.6.1 2021-10-27 11:05:16 +02:00
Etan Kissling
861b625a66 allow converting static vars to openArray (#19047)
When assigning constant output to a seq, and then passing that static
seq to other functions that take `openArray`, the compiler may end up
producing errors, as it does not know how to convert `static[seq[T]]`
to `openArray[T]`. By ignoring the `static` wrapper on the type for
the purpose of determining data memory location and length, this gets
resolved cleanly. Unfortunately, it is relatively tricky to come up
with a minimal example, as there are followup problems from the failing
conversion, e.g., this may lead to `internal error: inconsistent
environment type`, instead of the relevant `openArrayLoc` error message.

(cherry picked from commit 490c4226a5)
2021-10-27 11:03:22 +02:00
narimiran
727c6378d2 bump NimVersion to 1.6.0 v1.6.0 2021-10-18 16:36:47 +02:00
Jason Beetham
f0af4a36b9 Added setGlobalValue to VM api (#19007) 2021-10-17 16:24:43 +02:00
Timothee Cour
f77dea01fd define nimVersion automatically and avoid needing -d:nimVersion140 (#18726)
* define `nimVersion` and avoid needing -d:nimVersion140

* fix changelog
2021-10-17 08:37:52 +02: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
ee7
f4525efcf3 changelog_1_6_0: mention breaking change in effect tracking (#18995) 2021-10-15 09:10:27 +02:00
flywind
73330711a3 make choosenim work on windows [backport] (#18993) 2021-10-14 23:55:05 +08:00
Miran
8a4eeba218 try to fix broken ssl test (#18991) 2021-10-14 09:56:58 +02:00
flywind
3493783d0f test whether it is unnecessary (#18893) 2021-10-14 09:23:36 +02:00
flywind
c4c9876785 fix a potential bug (#18900) 2021-10-14 09:23:01 +02:00
Miran
f93bfc0a32 [backport] add v1.6 changelog (#18932) 2021-10-13 20:31:04 +02:00
flywind
e2b19bb2de remove deprecated stuffs from std/times (#18937) 2021-10-13 14:58:31 +02:00
flywind
2ac3ba713b fix #18985 (#18988) 2021-10-13 14:57:25 +02:00
林亦恩
e645be4d0c add ghci like type annotation buildEchoStmt (1049) (#18875)
* add ghci like type annotation buildEchoStmt (1049)

* Update compiler/semexprs.nim

* Update compiler/semexprs.nim

Co-authored-by: flywind <xzsflywind@gmail.com>

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: flywind <xzsflywind@gmail.com>
2021-10-13 11:35:47 +02:00
Dominik Picheta
2aa97a228a Removes deprecated {.injectStmt.}. Fixes #18666 (#18984) 2021-10-13 11:09:45 +02:00
Juan Carlos
0ae2d1ea88 Improve error message when NodeJS is not installed and 'nim js -r' is run (#18978) 2021-10-12 15:41:30 +02:00
narimiran
83128f217f disable testing of fidget, to make CIs green 2021-10-11 14:38:59 +02:00
antonl05
787def271b add OpenIndiana to list (#18972)
* add OpenIndiana support

* point sunos to solaris
2021-10-09 10:47:07 +02:00
flywind
08107c2192 [minor] give more friendly description (#18973) 2021-10-07 18:54:21 +02:00
Andreas Rumpf
6f15af41a7 fixes a regression caused by overloadable enums even though they're opt-in (#18970) 2021-10-07 15:07:24 +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
8eef557157 fixes a 'mixin' statement handling regression [backport:1.2] (#18968) 2021-10-07 12:01:06 +02:00
Miran
eede2bfb5d update csources hash (#18969) 2021-10-07 10:48:09 +02:00
Andrey Makarov
f03872d99e rst: minor fixes (#18960) 2021-10-06 13:53:01 +02:00
flywind
b2873f0f63 [tools] use the right parameter [backport:1.0] (#18957) 2021-10-06 12:47:46 +02:00
flywind
cb30dc5170 enable tests for #2710 (#18961) 2021-10-06 09:42:35 +02:00
quantimnot
9fc2918314 Document how to compile a reproducible build (#18953)
* Make compiler build more reproducible

Removed the compile time from the version output.
Added Git commit's author's datetime in UTC timezone.

Fixes #18508

See https://reproducible-builds.org/docs/timestamps/
See https://reproducible-builds.org/docs/source-date-epoch/

* Revert "Make compiler build more reproducible"

This reverts commit 2f9359ae89.

Documented how to use compile reproducible builds with the
`SOURCE_DATE_EPOCH` environment variable.

* Corrected `readme.md` formatting

Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
2021-10-06 09:41:42 +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
Andreas Rumpf
500d5f0f38 typo [backport] (#18948) 2021-10-04 12:34:29 +02:00
flywind
97c24dd548 correct changelog [backport] (#18940) 2021-10-04 09:19:20 +02:00
Dominik Picheta
6b0db5be1f Fixes build_all.sh failing on Nimble builds (#18945)
When running `build_all.sh` I was getting:

```
bin/nim c -o:bin/nimsuggest -d:danger --skipUserCfg --skipParentCfg --hints:off nimsuggest/nimsuggest.nim
bin/nim c -o:bin/nimgrep -d:release --skipUserCfg --skipParentCfg --hints:off tools/nimgrep.nim
bin/nim c -o:bin/nimpretty -d:release --skipUserCfg --skipParentCfg --hints:off nimpretty/nimpretty.nim
bin/nim c -o:bin/testament -d:release --skipUserCfg --skipParentCfg --hints:off testament/testament.nim
bin/nim c -o:bin/nim_dbg --opt:speed --stacktrace -d:debug --stacktraceMsgs -d:nimCompilerStacktraceHints --skipUserCfg --skipParentCfg --hints:off compiler/nim.nim
bin/nim c -o:bin/atlas -d:release --skipUserCfg --skipParentCfg --hints:off tools/atlas/atlas.nim
/home/dom/.choosenim/toolchains/nim-#devel/koch.nim(722) koch
/home/dom/.choosenim/toolchains/nim-#devel/koch.nim(149) bundleNimbleExe
/home/dom/.choosenim/toolchains/nim-#devel/tools/deps.nim(32) cloneDependency
/home/dom/.choosenim/toolchains/nim-#devel/lib/pure/os.nim(1438) setCurrentDir
/home/dom/.choosenim/toolchains/nim-#devel/lib/pure/includes/oserr.nim(95) raiseOSError
Error: unhandled exception: No such file or directory
Additional info: '/home/dom/.choosenim/toolchains/nim-#devel/dist/nimble' [OSError]
```

With this patch it builds.
2021-10-03 07:25:15 +02:00
flywind
45c4332c81 document -d:nimStrictDelete [backport] (#18939) 2021-10-03 07:22:53 +02:00