Commit Graph

19547 Commits

Author SHA1 Message Date
Andreas Rumpf
faabcfa643 fixes #18558 (#18563)
* fixes #18558

* better fix
2021-07-23 16:15:40 +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
Jason Beetham
5386ae75ba Fixed template const tuple unpacking (#18562) 2021-07-23 08:46:13 +02:00
Andreas Rumpf
0c4582c665 mitigates #12815 (#18557)
* mitigates #12815

* Update doc/nimc.rst

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

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2021-07-22 11:59:21 +02:00
Andreas Rumpf
58e27ebd4a fixes #12815 (#18554) 2021-07-22 09:37:41 +02:00
Timothee Cour
d5b5827bc2 fix setCommand so it behaves like regular nim invocation (#18555) 2021-07-22 08:00:29 +02:00
Andreas Rumpf
01fc9e58ca fixes #18550 (#18553)
* fixes #18550

* update the manual to reflect reality
2021-07-21 16:55:50 +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
6f34829ee5 clean unused imports on runnableExamples (#18551) 2021-07-21 13:46:17 +02:00
Andreas Rumpf
f86a530214 breaking changes policies (#18541)
* document some std library evolution policies

In wanting to improve the standard library, it's helpful to have a set
of principles and guidelines to lean back on, that show how to introduce
such improvements while at the same time considering existing users of
the language.

A key idea behind documentation of this sort is that it should highlight
a path forwards in making changes rather than trying to prevent them,
and although the current snippet does include some language for what one
shouldn't do, it also shows a few options for what one can do.

This is a riff on https://github.com/nim-lang/Nim/pull/18468 mainly
based on what helps enable to the use of Nim productively in
environments and teams where the priority and focus is not always on the
tool (Nim in this case) but rather on the codebase itself, and its use
by end users.

We use similar guidance documentation to help coordinate the code of the
teams using Nim in https://status-im.github.io/nim-style-guide/ where it
is applied not as law, but rather as recommendations for the default
approach that should be considered first.

* document the new policies

* typo

* Update doc/contributing.rst

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

* Update doc/contributing.rst

* Update doc/contributing.rst

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

* Update doc/contributing.rst

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

* Update doc/contributing.rst

* Update doc/contributing.rst

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

* clarify some things

* Update doc/contributing.rst

Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>

Co-authored-by: Jacek Sieka <arnetheduck@gmail.com>
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
2021-07-21 10:22:30 +02:00
flywind
f048dad7c3 add testcase for #6499 #12229 #7172 (#18547) 2021-07-21 09:47:06 +02:00
Andreas Rumpf
9c2442af94 unary slices get a deprecation period (#18549) 2021-07-21 09:46:18 +02:00
Araq
b6f9f7a33e atlas: minor changes 2021-07-21 09:09:58 +02:00
Andreas Rumpf
70fb377e88 undo RFC #294, it breaks code for no good reason, the compiler can wa… (#18546)
* undo RFC #294, it breaks code for no good reason, the compiler can warn about the construct instead

* Update changelog.md

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

* enable test case

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2021-07-21 08:51:03 +02:00
Andreas Rumpf
f8519657c4 fixes #18469 (#18544)
* fixes #18469

* Update compiler/injectdestructors.nim
2021-07-20 22:15:06 +02:00
Timothee Cour
cf0cf32d27 make -d:nimFpRoundtrips work consistently in vm vs rt, fix #18400, etc (#18531)
* compiler/vmhooks: add getVar to allow vmops with var params
* addFloat vmops with var param
* cgen now renders float32 literals in c backend using roundtrip float to string
2021-07-20 22:13:52 +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
flywind
dbf8d0b894 use more .} (#18542) 2021-07-20 20:12:15 +08:00
Paul Roberts
6286b5599c termux ssl (#18520) 2021-07-20 12:50:43 +02:00
Andreas Rumpf
5e011e8e42 updated the changelog (#18539) 2021-07-20 10:37:36 +02:00
Araq
e38388eb4e use .} instead of } for code highlighters 2021-07-20 08:36:02 +02:00
Andrey Makarov
8c7ee96457 rst: add missing line/column info for some warnings (#18383)
* rst: add missing line/column info for some warnings

* add workaround

* use TLineInfo/FileIndex for storing file names

* fix blank lines in include file (rm harmful strip)

* don't use ref TLineInfo

* return `hasToc` as output parameter for uniformity

* Update compiler/docgen.nim

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

* Update compiler/docgen.nim

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

* Update lib/packages/docutils/rst.nim

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

* address review - stylistic things

* Update compiler/docgen.nim

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

* unify RST warnings/errors names

* doAssert + minor name change

* fix a bug caught by doAssert

* apply strbasics.strip to final HTML/Latex

* rm redundant filename

* fix test after rebase

* delete `order` from rnFootnoteRef,

also display errors/warnings properly when footnote references are from
different files

* Update compiler/lineinfos.nim

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

* Update lib/packages/docutils/rstast.nim

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

* Update lib/packages/docutils/rstast.nim

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

* Update lib/packages/docutils/rstast.nim

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

* revert because of error:

Error: cannot prove that it's safe to initialize 'info' with the runtime value for the discriminator 'kind'

* Update lib/packages/docutils/rstgen.nim

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

* apply suggestion

* Update lib/packages/docutils/rst.nim

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

* add Table for string->file name mapping

* do not import compiler/lineinfos

* fix ambiguous calls

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Co-authored-by: narimiran <narimiran@disroot.org>
2021-07-20 08:32:22 +02:00
flywind
44c5afe448 [std/os]document checkDir and use runnableExamples (#18517)
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-07-19 20:14:04 -07:00
Timothee Cour
db6e7fffba minor clenup in vmops (#18529) 2021-07-19 20:07:47 -07:00
konsumlamm
73ce40aaf7 Revert #17321 (#18521)
Use better names in example
2021-07-19 12:45:13 +02:00
ynfle
1e7a10001a Docs(manual): add clarification for default params (#18522)
* Docs(manual): add clarification for default params

* Docs(manual): fix wording to refer to call time

* Docs(manual): Clarify default parameter wording

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

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2021-07-19 12:44:06 +02:00
flywind
bdfee32dc8 close #18489 (#18524) 2021-07-19 12:43:31 +02:00
Timothee Cour
488e9c2991 nim doc now correctly renders deprecated pragmas for routines and types (#18515) 2021-07-19 12:42:45 +02:00
Antonis Geralis
220b55c5d7 attempt to support short commit hashes (#18514)
* attempt to support short commit hashes

Not sure if that's the correct way and what happens when the short hash matches "head"

* need to remove #

* Output needs to be stripped of newlines
2021-07-18 15:29:49 +02:00
Andreas Rumpf
99c4b69097 fixed system.delete (#18507) 2021-07-18 15:16:26 +02:00
Timothee Cour
adba5eb45e deprecate strutils.delete and add an overload with saner semantics consistent with sequtils.delete; follows #18487 (#18510) 2021-07-18 11:10:08 +02:00
Timothee Cour
3723140044 add NIM_STATIC_ASSERT(CHAR_BIT == 8, "") to fail-fast where assumption is violated (#18512) 2021-07-18 11:05:35 +02:00
Miran
8091545f95 Revert #17398 and #17402 (#18480)
* Revert "followup #17398: `getTempDir`, `getConfigDir` now do not have trailing DirSep (#17402)"

This reverts commit 2356d0603f.

* Revert "fix #17393 getHomeDir and expandTilde should not include trailing `/` (#17398)"

This reverts commit bebf2ce24a.

* fix test
2021-07-18 11:04:19 +02:00
konsumlamm
ac5435ecd0 Make error message for empty new-styled concept more descriptive (#18506)
* Allow empty new-styled concept

Slightly improve error messages

* Make empty new-styled concepts an error
2021-07-18 10:49:03 +02:00
Timothee Cour
923a1c6ea7 fix nativeToUnixPath (#18501) 2021-07-17 07:54:47 +02:00
Andreas Rumpf
25efb53862 make dragonbox opt-in via -d:nimFpRoundtrips (#18504)
* make dragonbox opt-in via -d:nimFpRoundtrips

* make tests green again

* make tests green again
2021-07-16 18:29:49 +02:00
Andreas Rumpf
96a7f9b31c deprecate cuchar, don't redefine it (#18505) 2021-07-16 15:50:02 +02:00
Andreas Rumpf
089e741ce4 added Atlas helper tool (#18497)
* added Atlas helper tool
* further improvements
2021-07-16 07:42:35 +02:00
Ivan Bobev
5e6680406f Add changes required by Nimble lock file support (#12104)
Implemented support for Nimble local cache with package directories with
a checksum of the package at the end of their names. Now the compiler
supports package paths in the form:

 * /path_to_nimble_cache_dir/pkgs/package_name-1.2.3-
FEBADEAEA2345E777F0F6F8433F7F0A52EDD5D1B

 * /path_to_nimble_cache_dir/pkgs/package_name-#head-
042D4BE2B90ED0672E717D71850ABDB0A2D19CD2

 * /path_to_nimble_cache_dir/pkgs/package_name-#branch-name-
DBC1F902CB79946E990E38AF51F0BAD36ACFABD9

Related to nim-lang/nimble#127
2021-07-15 22:13:01 +02:00
Timothee Cour
1d6863a789 deprecate sequtils.delete and add an overload with saner semantics consistent with system.delete (#18487)
* deprecate sequtils.delete and add an overload with saner semantics
* AssertionDefect => IndexDefect
* improve tsequtils
* add tests; use splice in js for optimization
2021-07-15 20:54:07 +02:00
quantimnot
a9701f6531 Extended side effect error messages (#18418)
* Extended side effect error messages

* Applied feedback:
- refactored `markSideEffect`
- refactored string interpolations
- single message
- skip diagnostics in `system.compiles` context

Other:
- started a test of diagnostic messages

[ci skip] Tests aren't updated yet because messaging isn't nailed down.

* - Added hints of where for side effect call locations.
- Tried to clarify the reasons.

* fix tests

* Applied PR review feedback:
  - moved collection of side effects from TSym to TContext
  - used pragma shorthand form `.sideEffect` and `.noSideEffect` in messages
  - added leading '>' to structured messages for readability
  - changed `sempass2.markSideEffect` to a proc
  - replaced `system.echo` in the test to make the test compatible with Windows

* Applied NEP1 formatting suggestion

Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
2021-07-15 20:43:57 +02:00
Andreas Rumpf
af3d2d8ad9 added nimAllocPagesViaMalloc switch (#18490)
* added  switch

* alloc.nim needs page aligned memory blocks
2021-07-15 17:58:47 +02:00
GordonBGood
8c6dd2b9a9 Improve description of how =trace is used (#18491)
* [skip ci] thamming_orc test created/destroyed counts match

The thamming_orc.nim code now counts all created objects being tested, not just the ones following the "first 20" test, and the position of the `destroyed += 1` counter has been adjusted so it counts all the calls that are as a result of `=trace` tracing and not just the original destruction calls.

* Improve description of how `=trace` is used

The following nuances weren't previously fully explained:

1. That `=trace` is only used by `--gc:orc`.
2. That `=trace` is almost certainly used along with `=destroy` when manual resource allocation has been used, but it is only required if there is a possibility of cyclic references in the wrapped types (ie. generic types).
3. That, currently, a forward definition is required for the second of the pair to avoid an auto compiler generation conflict.

The pattern of the use of `=trace` has also been made more extensive, showing how both a custom `=destroy` and `=trace` are used for manual allocation of resources when there is any possibility of a cyclic reference in the resource-wrapped values.

* Update doc/destructors.rst

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-07-15 14:35:53 +02:00
Timothee Cour
a6ff6e7871 fix https://github.com/dom96/choosenim/issues/256 WSL CRLF (#18452)
* fix https://github.com/dom96/choosenim/issues/256 WSL CRLF

* fixup
2021-07-14 18:52:09 +01:00
Andreas Rumpf
12da32a891 fixes #17893 (#18485)
* fixes #17893
2021-07-13 14:17:59 +02:00
Andreas Rumpf
b3aca78e22 closes #18433 (#18484)
* beneficial refactoring; use system.Endianness

* closes #18433
2021-07-13 12:44:29 +02:00
flywind
15fdcd0c4d workaround #18481 (#18482) 2021-07-13 09:22:33 +02:00
flywind
1b128ac045 close #17986 add testcase (#18477) 2021-07-12 18:18:07 -04:00