Commit Graph

7144 Commits

Author SHA1 Message Date
flywind
9a32905d89 nimscript ignore the threads option (#19370)
because nimscript doesn't support threads and causes troubles when the threads option is on
2022-01-13 08:02:41 +01:00
Andreas Rumpf
9888a29c3d bitsets.nim: cleanup (#19361) 2022-01-11 10:16:51 +01:00
flywind
92e5573b20 fix stylecheck error with asyncdispatch (#19350)
* stylecheck usages part two: stdlib cleanup

typeinfo.nim: importCompilerProc => importcompilerproc

nre.nim: newLineFlags => newlineFlags

system.nim: JSRoot => JsRoot

ref #19319

* prefer importCompilerProc

* fix stylecheck error with asyncdispatch

it is a partial regression since #12842

* add tests

* don't use echo in tests
2022-01-10 10:29:04 +01:00
flywind
ae92eac060 stylecheck usages part two: stdlib cleanup (#19338)
* stylecheck usages part two: stdlib cleanup

typeinfo.nim: importCompilerProc => importcompilerproc

nre.nim: newLineFlags => newlineFlags

system.nim: JSRoot => JsRoot

ref #19319

* prefer importCompilerProc
2022-01-08 21:34:22 +01:00
flywind
0bcd7062c6 correct the comments (#19322)
--expandArc

```
var
  a
  b
a = matrix(5, 5, 1.0)
b = matrix(5, 5, 2.0)
`=sink`(b, -
  let blitTmp = b
  wasMoved(b)
  blitTmp +
    a)
`=destroy`(b)
`=destroy`(a)
```
2022-01-04 11:10:46 +01:00
hlaaftana
61d682e733 Allow full commands and blocks in type sections (#19181)
* allow full commands and blocks in type sections
* update grammar
* fix changelog [skip ci]
* more tests
* even more tests
2022-01-02 07:29:55 +01:00
Andreas Rumpf
ac37eed5a2 fixes #16617 [backport] (#19300) 2021-12-31 09:21:30 +01:00
Andreas Rumpf
a61bbf7d8d fixes grammar typos [backport] (#19289) 2021-12-27 17:28:19 +01:00
Jason Beetham
fa96e56ad0 Fixed object field access of static objects in generics (#19283) [backport] 2021-12-23 07:12:56 +01:00
Andrey Makarov
19898e1225 Fix group reference (with capital letters (#19196)
in group name)
2021-12-20 15:10:15 -05:00
Andreas Rumpf
7ff43d07b2 added --nimMainPrefix switch; fixes #15955; refs #16945 [backport:1.6] (#19235) 2021-12-10 14:28:59 +01:00
Ștefan Talpalaru
69aabdab80 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++
2021-12-10 06:31:29 +01:00
Andreas Rumpf
32d4bf3525 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) 2021-12-09 22:23:16 +01:00
wenghongquan
742e9d65ad Add support for LoongArch (#19223)
* Add support for LoongArch

* Update compiler/installer.ini

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-12-09 14:00:33 +01:00
Andreas Rumpf
502ac4ed5e fixes a converter handling regression that caused private converters to leak into client modules; fixes #19213; [backport:1.6] (#19229) 2021-12-09 13:56:51 +01:00
Tanguy
cd592ed85b fix #19193 (#19195) [backport:1.2] 2021-12-07 18:01:22 +01:00
Etan Kissling
0213c7313b 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.
2021-12-06 20:38:23 +01:00
hlaaftana
1ef945668d treat do with pragmas but no parens as proc (#19191)
fixes #19188
2021-12-05 06:44:22 +01:00
Andreas Rumpf
1cbdc1573a fixes #19159 [backport:1.6] (#19210) 2021-12-04 07:44:26 +01:00
Andreas Rumpf
f90620fb32 fixes #19198 [backport:1.6] (#19209)
* fixes #19198 [backport:1.6]

* added a test case
2021-12-04 07:43:20 +01:00
Andreas Rumpf
d584dd5b99 fixes #19015 [backport:1.6] (#19204) 2021-12-04 07:42:58 +01:00
Andreas Rumpf
23c117a950 misc bugfixes [backport:1.2] (#19203) 2021-12-04 07:42:34 +01:00
hlaaftana
f91867aa31 accept object type node from macros (#19179) 2021-11-24 16:34:42 +01:00
Andreas Rumpf
a0073d2d4c renamed 'gc' switch to 'mm'; [backport:1.6] (#19187)
* renamed 'gc' switch to 'mm'; [backport:1.6]
* better docs
2021-11-24 15:49:32 +01:00
hlaaftana
c7c6b13a32 parseExpr/parseStmt accept filename, fixes #13540 (#19182) 2021-11-24 12:22:40 +01:00
hlaaftana
2859069dbe fix #12274 (#19180) 2021-11-24 07:08:07 +01:00
hlaaftana
5933aece9b caseStmtMacros no longer experimental, experimental manual refactor (#19173)
* `caseStmtMacros` no longer experimental, experimental manual refactor

* Update doc/manual.rst

* apply review suggestions

* apply review

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-11-23 16:30:17 +01:00
hlaaftana
1b143f5e79 Accept nnkTypeSection from typedef macro pragmas (#19168) 2021-11-22 10:41:35 +01:00
flywind
fe46c8b5f1 fix marshal bugs in VM (#19161) [backport:1.6] 2021-11-17 10:15:54 +01:00
Andreas Rumpf
c6fc3b2eae fixes #19051 [backport:1.6] (#19133) 2021-11-12 11:19:24 +01:00
Andreas Rumpf
15157d06c3 fixes #14470 [backport:1.2] (#19115) 2021-11-09 22:48:04 +01:00
Andreas Rumpf
6ff61766da fixes #19011 [backport:1.6] (#19114) 2021-11-09 18:59:59 +01:00
Andreas Rumpf
b7c66ce860 fixes #19013 [backport:1.6] (#19111)
* fixes #19013 [backport:1.6]

* added test case
2021-11-09 12:43:16 +01:00
Andrey Makarov
b21eb1ed36 change os.nim doc links to new style (#19102) 2021-11-08 13:10:01 +01:00
Andreas Rumpf
fce89cb60a fixes another effect inference bug [backport:1.6] (#19100)
* fixes another effect inference bug [backport:1.6]
2021-11-07 16:38:02 +01:00
Andreas Rumpf
9d51197aa4 fixes #19078 [backport] (#19090) 2021-11-02 16:30:59 +01:00
Jason Beetham
cc984217a9 Fix VM's sametype impl to work for generics/typedescs (#19073)
* Fix vm's sametype implementation to properly handle generics and typedescs

* actually fixed sametype + have test

* added comments and removed unsafe code
2021-11-02 09:02:53 +01:00
haxscramper
4c510d5577 [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.`
2021-11-02 08:54:04 +01:00
flywind
2f730afe9e fix #18410 (Errors initializing an object of RootObj with the C++ backend) [backport] (#18836)
* fix #18410

* one line comment

* typo

* typo

* cover cpp
2021-10-31 06:22:00 +01:00
Derek 呆
f755e452d2 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.
2021-10-29 19:55:48 +02:00
Andrey Makarov
7ba2659f73 docgen: implement doc link resolution in current module (#18642) 2021-10-28 19:20:52 +02:00
Jason Beetham
8d5a275189 Fixed distinct composite type class proc borrowing (#18904)
* Fixed composite type class proc borrowing

* Moved borrow search into transf

* added borrow check to symbol flag
2021-10-26 11:29:07 +02:00
Jason Beetham
83a2515af7 Fixed generic distinct conversions for 'var' (#18837)
* SameTypeAux now properly traverses generic distincts

* Smarter traversal of distincts

* Removed redundant check

* Fixed nkConv for jsgen

* Added test for non distinct nkConv

* using skiptypes for distinct now

* Fixed genaddr for nkconv
2021-10-26 11:27:11 +02:00
Jaremy Creechley
141b76e365 Add Zephyr Support (#19003)
* Porting Nim to run on Zephyr.

Includes changes to `std/net`.

Squashed commit of the following:
    tweaking more memory / malloc things
    revert back bitmasks
    tweaking nim to use kernel heap as C malloc doesn't work
    fixing socket polling on zephyr
    cleanup getting maximum sockets for process or for rtos'es
    reorganizing and fixing net for async / system
    merge netlite changes back into nativesockets
    merge netlite changes back into nativesockets
    reverting native sockets back
    tweaking nim / zephyr network
    adding option to run 'net-lite' from linux
    bridging zephyr's max connections
    fixing net errors
    fixing compilation with getAddrString
    fixing compilation with getAddrString
    experimenting with a nativesockets_lite ... getAddrString
    experimenting with a nativesockets_lite ... getAddrString
    experimenting with a nativesockets_lite ... getLocalAddr
    experimenting with a nativesockets_lite ... getLocalAddr
    experimenting with a nativesockets_lite ...
    add note regarding incorrect FreeRTOS Sockadd_in fields
    changing to NIM_STATIC_ASSERT
    cleaning up the static_assert error messages
    cleaning up the static_assert error messages
    setting up static assert ftw!
    testing compile time asserts
    reworking Sockaddr objects to more closely match various platforms
    reworking Sockaddr objects to more closely match various platforms
    reworking Sockaddr objects to more closely match various platforms
    finding missing items (issue  #18684)
    fixup posix constants (issue  #18684)
    adding plumbing for zephyr os (issue  #18684)
    adding plumbing for zephyr os (issue  #18684)

* fixing constant capitalizations

* remove extra debug prints and fix TSa_Family/cint issue

* remove extra debug prints and fix TSa_Family/cint issue

* Porting Nim to run on Zephyr.

Includes changes to `std/net`.

Squashed commit of the following:
    tweaking more memory / malloc things
    revert back bitmasks
    tweaking nim to use kernel heap as C malloc doesn't work
    fixing socket polling on zephyr
    cleanup getting maximum sockets for process or for rtos'es
    reorganizing and fixing net for async / system
    merge netlite changes back into nativesockets
    merge netlite changes back into nativesockets
    reverting native sockets back
    tweaking nim / zephyr network
    adding option to run 'net-lite' from linux
    bridging zephyr's max connections
    fixing net errors
    fixing compilation with getAddrString
    fixing compilation with getAddrString
    experimenting with a nativesockets_lite ... getAddrString
    experimenting with a nativesockets_lite ... getAddrString
    experimenting with a nativesockets_lite ... getLocalAddr
    experimenting with a nativesockets_lite ... getLocalAddr
    experimenting with a nativesockets_lite ...
    add note regarding incorrect FreeRTOS Sockadd_in fields
    changing to NIM_STATIC_ASSERT
    cleaning up the static_assert error messages
    cleaning up the static_assert error messages
    setting up static assert ftw!
    testing compile time asserts
    reworking Sockaddr objects to more closely match various platforms
    reworking Sockaddr objects to more closely match various platforms
    reworking Sockaddr objects to more closely match various platforms
    finding missing items (issue  #18684)
    fixup posix constants (issue  #18684)
    adding plumbing for zephyr os (issue  #18684)
    adding plumbing for zephyr os (issue  #18684)

* fixing constant capitalizations

* remove extra debug prints and fix TSa_Family/cint issue

* remove extra debug prints and fix TSa_Family/cint issue

* fixing PR issues

* Porting Nim to run on Zephyr.

Includes changes to `std/net`.

Squashed commit of the following:
    tweaking more memory / malloc things
    revert back bitmasks
    tweaking nim to use kernel heap as C malloc doesn't work
    fixing socket polling on zephyr
    cleanup getting maximum sockets for process or for rtos'es
    reorganizing and fixing net for async / system
    merge netlite changes back into nativesockets
    merge netlite changes back into nativesockets
    reverting native sockets back
    tweaking nim / zephyr network
    adding option to run 'net-lite' from linux
    bridging zephyr's max connections
    fixing net errors
    fixing compilation with getAddrString
    fixing compilation with getAddrString
    experimenting with a nativesockets_lite ... getAddrString
    experimenting with a nativesockets_lite ... getAddrString
    experimenting with a nativesockets_lite ... getLocalAddr
    experimenting with a nativesockets_lite ... getLocalAddr
    experimenting with a nativesockets_lite ...
    add note regarding incorrect FreeRTOS Sockadd_in fields
    changing to NIM_STATIC_ASSERT
    cleaning up the static_assert error messages
    cleaning up the static_assert error messages
    setting up static assert ftw!
    testing compile time asserts
    reworking Sockaddr objects to more closely match various platforms
    reworking Sockaddr objects to more closely match various platforms
    reworking Sockaddr objects to more closely match various platforms
    finding missing items (issue  #18684)
    fixup posix constants (issue  #18684)
    adding plumbing for zephyr os (issue  #18684)
    adding plumbing for zephyr os (issue  #18684)

* fixing constant capitalizations

* remove extra debug prints and fix TSa_Family/cint issue

* remove extra debug prints and fix TSa_Family/cint issue

* Remerge

* fixing constant capitalizations

* remove extra debug prints and fix TSa_Family/cint issue

* remove extra debug prints and fix TSa_Family/cint issue

* fixing PR issues

* fix maxDescriptors on zephyr/freertos

* move maxDescriptors to selector.nim -- fixes compile issue

* change realloc impl on zephyr to match ansi c behavior

* change realloc impl on zephyr to match ansi c behavior

* force compileOnly mode for tlwip

Co-authored-by: Jaremy J. Creechley <jaremy.creechley@wavebaselabs.com>
Co-authored-by: Jaremy Creechley <jaremy.creechley@panthalassa.com>
2021-10-24 11:51:57 +02:00
Etan Kissling
490c4226a5 allow converting static vars to openArray (#19035)
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.
2021-10-22 17:32:02 +02:00
flywind
4d8108046b remove exception (#18906) 2021-10-22 12:15:08 +02:00
Danil Yarantsev
5e2b9341f3 Add Elbrus 2000 architecture (#19024)
* Add Elbrus 2000 architecture

* Add e2k to niminst

* Update compiler/installer.ini

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-10-21 17:01:48 +02:00
Andreas Rumpf
1a45da9150 use two underscores for easy demangling [backport:1.6] (#19028) 2021-10-21 16:53:15 +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