Commit Graph

18917 Commits

Author SHA1 Message Date
Bung
a81434a890 Fix 14127 js from int to int casting (#15918)
* fix #14127 from int to int casting

* add test for #14127

* use template for test, also test uint2int

* move to tests/types/t14127_cast_number.nim targets:c cpp js
2020-11-11 17:41:49 +00:00
narimiran
f02c7542fc nimdoc: items of ordered lists now have numbers instead of circles 2020-11-11 15:59:41 +01:00
narimiran
b831033db6 remove codeowners [ci skip] 2020-11-11 14:02:35 +01:00
ee7
42c434fa3d Docs(strutils): Fix broken links (#15912)
The `dedent` and `unindent` links were introduced by commit d67c5cb751
(#15264).
2020-11-11 10:37:14 +08:00
flywind
35f8803250 close #4318(add testcase for #4318) (#15904)
* close #4318(add testcase for #4318)

* Update tests/objects/t4318.nim

Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>

Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>
2020-11-11 10:29:17 +08:00
Miran
bbe49a14ae Correct all eggs (#15906)
* "eg" is a misspelled "egg", "e.g." is "exempli gratia"
* Also, "ie" is "i.e.".
2020-11-10 21:53:25 +01:00
Timothee Cour
bc3c0487d3 remove ioutils mention in changelog (#15907) 2020-11-10 10:54:10 -06:00
narimiran
c44ae647a9 fix norm package testing command 2020-11-10 13:25:05 +01:00
flywind
b38f0403fd fix #12471 (#15901)
* fix #12471

* add testcase

* fix

* test nimdoc is tricky

* Delete t12471.nim
2020-11-10 13:15:16 +01:00
narimiran
17acf146a0 followup #15854: add a changelog entry about markdown tables support 2020-11-10 12:46:13 +01:00
Miran
ee78d76108 rst: add support for markdown tables (#15854)
* rst: add support for markdown tables

* change template into proc

* don't create unnecessary `seq[string]`
2020-11-10 09:41:26 +01:00
flywind
d8e7caf5dd follow #15874(add testcase for #15874) (#15893) 2020-11-10 09:23:58 +08:00
cooldome
338602a402 fix #15825 (#15894)
* fix #15825

* better fix
2020-11-09 19:24:32 +01:00
Timothee Cour
c1664f93b0 new: nim -e:cmd to run a command directly; also fixes #15731 (#15687)
* new: `nim -i cmd`
* rename -i to -e (for eval); consistent with majority of other programing languages
* `nim e -e:cmd` now works; bugfix: `echo cmd | nim e -` now works
* honor --betterRun
* address comments
* --eval alias for -e (replaces undocumented --eval which was a noop)
* --eval now defaults to e (nimscript) instead of r
* address comment: remove -e, only keep --eval
* address comment
* fixup
* Update compiler/nimconf.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2020-11-09 16:07:22 +01:00
Aethylia
53eca459f1 Added [:T] syntax explanation to generics tutorial. (#15890)
* Added [:T] syntax explanation to generics tutorial.

* Update doc/tut2.rst

Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com>

* Update doc/tut2.rst

Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com>

* Made second generics example runnable and added test line.

* Update doc/tut2.rst

* Update doc/tut2.rst

* Update doc/tut2.rst

Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2020-11-09 14:14:06 +01:00
ee7
3948b40bcd CI(actions): Replace deprecated add-path commands (#15892)
This commit resolves the following warning in the CI logs:

> Error: The `add-path` command is deprecated and will be disabled soon.
> Please upgrade to using Environment Files. For more information see:
> https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

The deprecation is due to an injection vulnerability (CVE-2020-15228).

See:
- https://bugs.chromium.org/p/project-zero/issues/detail?id=2070
- https://github.com/nim-lang/Nim/runs/1373146963#step:8:1
2020-11-09 13:08:17 +01:00
cooldome
69fe707025 Fix 15629 (#15888)
* fix #15858

* fix space

* fix #15629

* Revert "fix space"

* Revert "fix #15858"
2020-11-09 12:26:12 +01:00
cooldome
d5a0a5dfff Fix #15858 (#15887)
* fix #15858
* fix space
* fix #15629
* Revert "fix #15629"
2020-11-09 12:21:56 +01:00
n5m
3bff12b966 improve Testament docs (#15881)
* fix mentions of recursive test discovery

* document that {.fatal.} pragmas cannot be caught
2020-11-09 12:20:55 +01:00
Bung
204435ad97 export PrettyOptions,prettyPrint from nimpretty (#15865) 2020-11-09 12:05:17 +01:00
cooldome
7b19217798 fix #15707 (#15870) 2020-11-09 11:47:29 +01:00
flywind
673c5990c6 fix #12558 (#15864)
* fix #12558
* Update compiler/pragmas.nim
2020-11-09 11:46:25 +01:00
n5m
3be404af04 include example of error-marked copy proc (#15886)
* include example of error-marked copy proc

* Update destructors.rst
2020-11-09 11:45:43 +01:00
Ivan Bobev
d03f24147a Add a macro returning enum items count (#15824)
Add a macro `enumLen` which is used to determine the number of items in
an enumeration type to the `typetraits.nim` module. Also, add unit tests
for it in the `ttypetraits.nim` module.

Related to nimlang/Nim#15824
2020-11-09 10:02:01 +01:00
Andrey Makarov
5db181f377 Nimgrep improvements 2 (#15612)
* nimgrep: speed up by threads and Channels
* nimgrep: add --bin, --text, --count options
* nimgrep: add --sortTime option
* allow Peg in all matches
including --includeFile, --excludeFile, --excludeDir

* add --match and --noMatch options
* add --includeDir option
* add --limit (-m) and --onlyAscii (-o) options
* fix performance regression

introduced in nimgrep improvements #12779

* better error handling
* add option --fit
* fix groups in --replace
* fix flushing, --replace, improve --count
* use "." as the default directory, not full path
* fix --fit for Windows
* force target to C for macosx
* validate non-negative int input for options #15318
* switch nimgrep to using --gc:orc
* address review: implement cropping in matches,...
* implement stdin/pipe & revise --help
* address stylistic review & add limitations
2020-11-09 09:19:06 +01:00
Luca Guzzon
49f68122e6 Console apps in Windows can raise OSError (#15874)
Console apps in Windows implementation can raise OSError so I've fixed it, see below some examples for reference:
- c07807bedf/lib/pure/terminal.nim (L170)
- c07807bedf/lib/pure/terminal.nim (L178)
- c07807bedf/lib/pure/terminal.nim (L191-L192)
- c07807bedf/lib/pure/terminal.nim (L196-L197)
- ...
2020-11-08 11:51:40 +08:00
flywind
203bddf307 close #11637(add testcase for #11637) (#15879)
* close #11637(add testcase for #11637)

* Update tests/vm/t11637.nim
2020-11-08 11:02:12 +08:00
sherbst
552075d10e Fix typo in lexer.nim (#15876) 2020-11-07 15:58:49 +01:00
Bung
c07807bedf Fix #15706 (#15846)
* fix #15706 Underflow not detected when using dec on distinct ranges

* fix #15846 first, jsgen even doesn't care of range in this op
2020-11-07 08:00:41 +00:00
flywind
8f7a013cc7 close #8558(add testcase for #8558) (#15872) 2020-11-07 07:59:47 +00:00
flywind
5828620d47 uint and uint64 is Ordinal type since nim 1.0.0 (#15873) 2020-11-07 07:58:52 +00:00
Ivan Bobev
3c85aa9e53 Make {.requiresInit.} to work for distinct types (#15869)
Make `requiresInit` pragma to work for distinct types in addition to
objects. Tagging of distinct types with `requiresInit` pragma was
already supported, but its impact wasn't applied. Now its behavior when
applied on distinct types is as follows.

Given the following distinct type definitions:

  ```nim
  type
    DistinctObject {.requiresInit, borrow: `.`.} = distinct MyObject
    DistinctString {.requiresInit.} = distinct string
  ```

The following code blocks will fail to compile:

  ```nim
  var foo: DistinctFoo
  foo.x = "test"
  doAssert foo.x == "test"
  ```

  ```nim
  var s: DistinctString
  s = "test"
  doAssert s == "test"
  ```

But these ones will compile successfully:

  ```nim
  let foo = DistinctFoo(Foo(x: "test"))
  doAssert foo.x == "test"
  ```

  ```nim
  let s = "test"
  doAssert s == "test"
  ```
2020-11-06 18:56:09 +00:00
Clyybber
60c364fb22 Closes #12897 (#15867) 2020-11-06 23:49:51 +08:00
flywind
fb60e35a54 close #8829(add testcase for #8829) (#15866) 2020-11-06 23:39:20 +08:00
flywind
9fd67958b9 follow #11707(add pragmas examples for =>) (#15863) 2020-11-06 11:42:43 +01:00
flywind
218ff27b70 fix #15851 (#15852)
* fix #15851

* {.cast(noSideEffect).}
2020-11-06 11:40:14 +01:00
cooldome
cdd459dd60 static[T] related fixes (#15853)
* close #9679

* close #7546

* close #9520

* close #6177
2020-11-06 10:25:43 +01:00
cooldome
fa5f225efc fix #15609 (#15856)
* fix #15609

* fix test
2020-11-05 23:29:05 +01:00
Clyybber
d1bea1f71f Tiny unittest doc fix 2020-11-05 21:02:14 +01:00
cooldome
3af7818af4 Fix #12636 (#15850)
* close #11142

* fix #12636

* undo unwanted changes

* fix illegal recursion case
2020-11-05 18:55:52 +01:00
Andreas Rumpf
3aab6a409d micro improvements (#15849) 2020-11-05 14:56:44 +01:00
cooldome
9455a0c3e3 close #11142 (#15847) 2020-11-05 14:51:45 +01:00
flywind
adde5ba6b0 document #15618 (#15810)
* document #15618

* Update lib/pure/unittest.nim

* Update lib/pure/unittest.nim

Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>

* Update lib/pure/unittest.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>
2020-11-05 14:04:24 +01:00
flywind
c4cc907433 fix adding empty sequence to HTTP headers (#15783)
* fix adding empty sequence to HTTP headers

* add tests
2020-11-05 14:01:28 +01:00
flywind
8e1fa84b0d fix #15663 (#15839) [backport:1.4] 2020-11-05 14:00:49 +01:00
flywind
a8af664e8b fix #15463 (#15831) 2020-11-05 14:00:08 +01:00
flywind
cae92f670a change non-working example to runnableExamples (#15841) 2020-11-05 13:11:22 +01:00
flywind
dfa2f011d7 close #10307(add testcase for #10307) (#15840) 2020-11-05 18:55:42 +08:00
flywind
fdd25ed19c close #8457 (#15844) 2020-11-05 18:31:44 +08:00
cooldome
4c19c5dfae fix static[Slice[T]] as argument issue (#15842) 2020-11-04 19:52:53 +01:00