7119 Commits

Author SHA1 Message Date
Ștefan Talpalaru
a2f5e98baa nimRawSetjmp: support Windows (#19197)
* nimRawSetjmp: support Windows

Using `_setjmp()` directly is required to avoid some rare (but very
annoying) exception-related stack corruption leading to segfaults on
Windows, with Mingw-w64 and SEH.
More details: https://github.com/status-im/nimbus-eth2/issues/3121

Also add "nimBuiltinSetjmp" - mostly for benchmarking.

* fix for Apple's Clang++

(cherry picked from commit 69aabdab80)
2021-12-11 05:47:32 +01:00
Andreas Rumpf
b7a0c08b4f added --nimMainPrefix switch; fixes #15955; refs #16945 [backport:1.6] (#19235)
(cherry picked from commit 7ff43d07b2)
2021-12-10 21:39:58 +01:00
Andreas Rumpf
ac57c3193d fixes an old ARC bug: the produced copy/sink operations don't copy the hidden type field for objects with enabled inheritance; fixes #19205 [backport:1.6] (#19232)
(cherry picked from commit 32d4bf3525)
2021-12-10 11:46:35 +01:00
Andreas Rumpf
7cf5e73fb7 fixes a converter handling regression that caused private converters to leak into client modules; fixes #19213; [backport:1.6] (#19229)
(cherry picked from commit 502ac4ed5e)
2021-12-10 11:46:26 +01:00
Tanguy
c14008d77f fix #19193 (#19195) [backport:1.2]
(cherry picked from commit cd592ed85b)
2021-12-08 08:33:12 +01:00
Etan Kissling
ee876aee28 allow HSlice bounded by constants of distinct types (#19219) [backport:1.2]
When creating heterogenous slices of distinct types, the compiler does
not initialize the internal type's `size` before accessing it.
This then leads to this crash message:
```
compiler/int128.nim(594, 11) `false` masking only implemented for 1, 2, 4 and 8 bytes [AssertionError]
```
This patch initializes the `size` properly, fixing the problem.

(cherry picked from commit 0213c7313b)
2021-12-08 08:32:57 +01:00
Andreas Rumpf
8ed903d1d0 fixes #19159 [backport:1.6] (#19210)
(cherry picked from commit 1cbdc1573a)
2021-12-06 11:19:26 +01:00
Andreas Rumpf
bfa8188dac fixes #19198 [backport:1.6] (#19209)
* fixes #19198 [backport:1.6]

* added a test case

(cherry picked from commit f90620fb32)
2021-12-06 11:19:17 +01:00
Andreas Rumpf
56409c15c0 fixes #19015 [backport:1.6] (#19204)
(cherry picked from commit d584dd5b99)
2021-12-06 11:19:08 +01:00
Andreas Rumpf
b614d97a2d misc bugfixes [backport:1.2] (#19203)
(cherry picked from commit 23c117a950)
2021-12-06 11:18:58 +01:00
Andreas Rumpf
2bb3a85a7c renamed 'gc' switch to 'mm'; [backport:1.6] (#19187)
* renamed 'gc' switch to 'mm'; [backport:1.6]
* better docs

(cherry picked from commit a0073d2d4c)
2021-11-26 07:32:15 +01:00
flywind
1247043c90 fix marshal bugs in VM (#19161) [backport:1.6]
(cherry picked from commit fe46c8b5f1)
2021-11-22 16:30:41 +01:00
Andreas Rumpf
167881bb83 fixes #19051 [backport:1.6] (#19133)
(cherry picked from commit c6fc3b2eae)
2021-11-17 09:26:08 +01:00
Andreas Rumpf
3f6de926f0 fixes #14470 [backport:1.2] (#19115)
(cherry picked from commit 15157d06c3)
2021-11-11 16:16:31 +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
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
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
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
flywind
73330711a3 make choosenim work on windows [backport] (#18993) 2021-10-14 23:55:05 +08:00
flywind
3493783d0f test whether it is unnecessary (#18893) 2021-10-14 09:23:36 +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
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
Andreas Rumpf
8eef557157 fixes a 'mixin' statement handling regression [backport:1.2] (#18968) 2021-10-07 12:01:06 +02:00
flywind
677969f6ea alternative to #18918 (#18927)
* fix #16558

* add testcase
2021-09-30 16:57:06 +02:00
Jason Beetham
f915b3aa86 Alternative to #18928 (#18931)
* fixed #18841

* Added test
2021-09-30 16:55:43 +02:00
Andreas Rumpf
c38ab3e257 fixes #18921 [backport] (#18930) 2021-09-30 12:09:42 +02:00
Miran
b74b914e4f [backport] use old style hints in .cfg files (#18917)
refs #18085
2021-09-29 11:14:47 +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
08cf4cb1e5 test ord (#18909) 2021-09-28 11:35:04 +02:00
flywind
56bd5cbb87 fix a typo (canonilization => canonicalization) (#18914) 2021-09-28 03:05:22 -04:00
Andreas Rumpf
576fece909 fixes 'lent T' inside object constructor [backport] (#18911)
* fixes 'lent T' inside object constructor [backport]

* progress
2021-09-27 22:23:31 +02:00
Andreas Rumpf
cdf9ac675b this ensures libp2p continues to compile [backport] (#18908) 2021-09-27 19:25:00 +02:00
flywind
8bdb985395 fix wrong name (rnimsyn => renderer; pnimsyn => parser; scanner => lexer) (#18895)
* fix wrong module name

* rephrase more word
2021-09-25 13:22:00 +02:00
Andreas Rumpf
7e5eab571e closes #18690; make view types stricter [backport] (#18891)
* closes #18690

* don't allow capturing of view types [backport]
2021-09-24 16:27:34 +02:00
Clyybber
f7d642f2f3 [backport] arc: improve compile time of (nested) loops (#18890) 2021-09-24 14:59:48 +02:00
Andreas Rumpf
5d315ebcc2 ported Nim to proprietary CrossOS [backport] (#18889) 2021-09-24 13:24:41 +02:00
Andreas Rumpf
90a2b5afd8 correct effect tracking for .borrowed procs [backport] (#18882)
* correct effect tracking for .borrowed procs [backport]

* progress

* fix error message in a test

* correctly fix it

Co-authored-by: narimiran <narimiran@disroot.org>
2021-09-23 16:47:24 +02:00
Andreas Rumpf
6163bdd279 closes #16132 [backport] (#18880)
* closes #16132 [backport]

* fixes #16132 [backport]
2021-09-22 15:07:36 +02:00
Andreas Rumpf
0ad601d3c1 fixes #18856 [backport] (#18879) 2021-09-22 09:43:06 +02:00
Andreas Rumpf
14ced06bb1 fixes #18863 [backport] (#18871) 2021-09-20 11:37:54 +02:00