Commit Graph

1856 Commits

Author SHA1 Message Date
Andreas Rumpf
4fc22cdd4d fixes #21245; warn about destructors that can raise (#21726)
* fixes #21245; warn about destructors that can raise

* doc update

* progress

* typo

(cherry picked from commit 220b450489)
2023-06-15 12:43:59 +02:00
metagn
037f87d904 top-down type inference, implements rfc 149 (#20091)
* micro implementation of rfc 149

refs https://github.com/nim-lang/RFCs/issues/149

* number/array/seq literals, more statements

* try fix number literal alias issue

* renew expectedType with if/case/try branch types

* fix (nerf) index type handling and float typed int

* use typeAllowed

* tweaks + const test (tested locally) [skip ci]

* fill out more of the checklist

* more literals, change @ order, type conversions

Not copying the full call tree before the typedesc call check
in `semIndirectOp` is also a small performance improvement.

* disable self-conversion warning

* revert type conversions (maybe separate op later)

* deal with CI for now (seems unrelated), try enums

* workaround CI different way

* proper fix

* again

* see sizes

* lol

* overload selection, simplify int literal -> float

* range, new @ solution, try use fitNode for nil

* use new magic

* try fix ranges, new magic, deal with #20193

* add documentation, support templates

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
(cherry picked from commit 0014b9c48e)
2023-05-11 15:12:38 +02:00
Vindaar
410254b485 fix issue #20922 by handling missing expr in exprList for tkOf (#20930)
* fix issue #20922 by handling missing expr in `exprList` for `tkOf`

* fix line numbers in test case

* rewrite exprList requiring expr, add optionalExprList for except

As suggested by @metagn.

* update test case to reflect new code

* update grammar.txt

* update line numbers in test case taking into account nimout

Given the number of errors that are produced it seems easier to do it
this way instead of using `tt.Error`.

(cherry picked from commit 0a1d4ba842)
2023-04-26 09:31:33 +02:00
Tanguy
ab1717984d Allow recursive closure iterators (#19939)
(cherry picked from commit ce4078acd4)
2023-04-24 22:01:28 +02:00
Khaled Hammouda
85e943db50 Fix distinct requiresInit test and manual (#19901)
fix distinct test and manual

(cherry picked from commit caf6aff06b)
2023-04-24 21:58:34 +02:00
hlaaftana
4857d9204e treat do with pragmas but no parens as proc (#19191)
fixes #19188

(cherry picked from commit 1ef945668d)
2023-04-24 17:28:15 +02:00
narimiran
d0d8c95094 don't change code blocks in manual.rst 2022-12-16 08:44:56 +01:00
ringabout
f01ffbf6f1 fix #19580; add warning for bare except: clause (#21099)
* fix #19580; add warning for bare except: clause

* fixes some easy ones

* Update doc/manual.md

* fixes docs

* Update changelog.md

* addition

* Apply suggestions from code review

Co-authored-by: Jacek Sieka <arnetheduck@gmail.com>

* Update doc/tut2.md

Co-authored-by: Jacek Sieka <arnetheduck@gmail.com>
(cherry picked from commit 91ce8c385d)
2022-12-15 16:31:37 +01:00
tersec
d53a057f5f Use passc and passl consistently with compiler checking (#20068)
(cherry picked from commit 1a9123eb90)
2022-07-25 11:41:52 +02:00
quantimnot
fd76c00479 Refactor and doc package handling, module name mangling (#19821)
* Refactor and doc package handling, module name mangling

* Consolidate, de-duplicate and extend package handling
* Alter how duplicate module names of a package are handled
* Alter how module names are mangled
* Fix crash when another package is named 'stdlib' (test case added)
* Doc what defines a package in the manual

Modules with duplicate names within a package used to be given 'fake'
packages to resolve conflicts. That prevented the ability to discern if
a module belonged to the current project package or a foreign package.
They now have the proper package owner and the names are mangled in a
consistent manner to prevent codegen clashes.

All module names are now mangled the same. Stdlib was treated special
before, but now it is same as any other package. This fixes a crash
when a foreign package is named 'stdlib'.

Module mangling is altered for both file paths and symbols used by the
backends.

Removed an unused module name to package mapping that may have been
intended for IC. The mapping was removed because it wasn't being used
and was complicating the issue of package modules with duplicate names
not having the proper package owner assigned.

* Fix some tests

* Refactor `packagehandling`

* Remove `packagehandling.withPackageName` and its uses
* Move module path mangling from `packagehandling` to `modulepaths`
* Move `options.toRodFile` to `ic` to break import cycle

* Changed import style to match preferred style

Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
(cherry picked from commit d30c6419a0)
2022-07-18 07:55:08 +02:00
Alfred Morgan
3e39f5bfec varargs example erroneously transformed "abc" to "def" (#19781)
(cherry picked from commit 85bc8326ac)
2022-05-24 15:28:24 +02:00
quantimnot
c6e3ad4ab9 Fix default testament target in docs and cli help (#19796)
Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
(cherry picked from commit a8426fc789)
2022-05-24 15:24:02 +02:00
Jaremy Creechley
4877caa462 Implement threads on Zephyr (#19156)
* pthreads setup for zephyr

- enable tweak stack size
- update lib/system/threads.nim
- Fix int/uint in casting pointer.

* add documentation and tweak flag names

* add documentation and tweak flag names

* fix configuration flag names

* fix configuration flag names

* cleanup

Co-authored-by: Jaremy Creechley <jaremy.creechley@panthalassa.com>
(cherry picked from commit 7772ca303c)
2022-03-24 13:26:05 +01:00
Jaremy Creechley
b9363c8bb4 Enable customizing PageShift to set PageSize for embedded targets (#19129)
* Enable customizing PageSize (via PageShift).

This enables adjusting PageSize for embedded targets without abusing
cpu16.

* copy nimPageXYZ settings for mmpaptest

* add docs for Nim manual

* add docs for Nim manual

* docs tweaks

Co-authored-by: Jaremy Creechley <jaremy.creechley@panthalassa.com>
(cherry picked from commit 92d6fb86c6)
2022-03-24 13:25:40 +01:00
Omar Flores
01c38610f5 Fixed formatting error for warningAsError. (#19634)
There was only a single space character between the warning and its description, so it shows up as part of the name (in bold) and with no description.
Copied the way hotCodeReloading was formatted, with the description in a new line.
2022-03-22 16:18:15 +01:00
rockcavera
47888c18f7 Update manual.rst (#19301)
(cherry picked from commit ef634cc251)
2022-01-26 18:30:56 +01:00
Andreas Rumpf
0648cde117 fixes grammar typos [backport] (#19289)
(cherry picked from commit a61bbf7d8d)
2021-12-31 05:13:52 +01:00
Don-Duong Quach
f4e41e6c4f Fixed typo in manual.rst unsafeAssign->uncheckedAssign. Fixes part 1 of #19266 (#19267)
(cherry picked from commit 610516e027)
2021-12-18 17:47:40 +01:00
Nan Xiao
70320482be basicopt.txt: Unify the format (#19251)
(cherry picked from commit 78b86b7942)
2021-12-14 18:18:57 +01:00
Ștefan Talpalaru
bcf9448a75 nimc.rst: fix table markup (#19239)
(cherry picked from commit 1a92edeb89)
2021-12-11 05:47:36 +01:00
Ș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
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
73366c015f update manual (#19130) [backport]
(cherry picked from commit 3aaa12dbe5)
2021-11-17 09:25:57 +01: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
500d5f0f38 typo [backport] (#18948) 2021-10-04 12:34:29 +02:00
Andreas Rumpf
c3dd53bb2c typos [backport] (#18929) 2021-09-30 11:35:42 +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
Miran
561b01004c [backport] change some examples in tut1.rst (#18884)
* [backport] change some examples in tut1.rst

* Update doc/tut1.rst

* Update doc/tut1.rst

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-09-24 11:24:55 +02:00
Andreas Rumpf
ca51bb8fd9 documented overload disambiguation [backport] (#18865)
* documented overload disambiguation [backport]

* Update doc/manual.rst

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

* documented overload disambiguation [backport]

* documented overload disambiguation [backport]

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2021-09-19 18:31:55 +02:00
Andreas Rumpf
179fad934d doc improvements (#18843)
* cleaned up destructors documentation [backport]

* Spec updates [backport:1.0]
2021-09-13 11:05:09 +02:00
Andreas Rumpf
2e2d928846 formal grammar updates [backport:1.2] (#18803) 2021-09-04 19:52:57 +02:00
flywind
b3ad68edea remove channels (#18801)
* remove channels

* test
2021-09-04 15:57:02 +02:00
Andreas Rumpf
686096a912 documented overloadable enums and changelog improvements (#18797) 2021-09-04 12:52:24 +02:00
Andreas Rumpf
cddf8ec6f6 implements https://github.com/nim-lang/RFCs/issues/407 (#18793) 2021-09-03 21:52:24 +02:00
Andreas Rumpf
c2b20516d3 implemented Unicode operators (#18789)
* implemented Unicode operators; refs https://github.com/nim-lang/RFCs/issues/388

* bugfix

* better test

* arguably more elegant implementation

* Update changelog.md

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

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2021-09-03 17:31:16 +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
0ddd9519c0 Remove Covariance section from the experimental manual (#18688)
* Remove `Covariance` section

* Add blank lines after `.. code-block::`

* Fix CI?
2021-08-29 10:42:52 +02:00
Timothee Cour
3aa16c1de0 fix RFC #341: dot-like operators are now parsed with same precedence as . (#18711)
* fix RFC #341: dot-like operators are now parsed with same precedence as `.`

* fixup

* [skip ci] address comment in changelog

* address comment

* update grammmar

* add manual entry

* fixup

* -d:nimPreviewDotLikeOps

* address comment to unblock PR: move nimPreviewDotLikeOps out of config/config.nims
2021-08-25 06:50:40 +02:00
flywind
5b26f2bd81 fix deprecated example (#18721) 2021-08-21 08:22:00 +02:00
flywind
e52221e296 [docs]fix an item missing (#18717) 2021-08-20 20:00:04 +02:00
Timothee Cour
1acba63cb7 cross compilation targetting windows now supports nim r: nim r -d:mingw main (#18682)
* cross compilation targetting windows now supports `nim r`: `nim r -d:mingw main`

* quoteShell

* address comment: remove `conf.getConfigVar("nimrun.exe")`
2021-08-16 09:32:12 +02:00
Andreas Rumpf
4463a3c3d7 manual: minor improvements (#18687) 2021-08-13 12:34:28 +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
Juan Carlos
2cddf7fc96 Documentation only, add 1 example (#18621)
* ReSync with Devel

* ReSync

* Documentation only, add 1 example to For loop macro

* Flip it

* Update doc/manual.rst

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-08-08 19:26:34 +02:00
Juan Carlos
6563a685c1 Documentation only, add 1 example (#18633) 2021-08-03 09:16:33 -07:00
Andrey Makarov
bbe05c1532 docgen: draw frame around active anchors (#18607) 2021-07-29 13:30:19 +02:00
konsumlamm
1bba641fed Update lib.rst (#18605)
* Update lib.rst

* Remove "Unstable" category

Add `strbasics`

* Update doc/lib.rst

* Update doc/lib.rst

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-07-29 10:50:17 +02:00
GordonBGood
37f5f0d7d0 Clarify use of import via pseudo dir... (#18569) 2021-07-27 09:38:30 +02:00