Commit Graph

18103 Commits

Author SHA1 Message Date
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
c-blake
f17555770e Clarify the sense in which Nim supports recursive iterators in the (#15834)
manual, the tutorial, and the `tbintree` test.
2020-11-04 16:56:22 +01:00
flywind
7d640e0943 fix #15835 (#15838)
* fix #15835

* add tests
2020-11-04 01:24:40 -05:00
flywind
b0e26d8fbf remove iup from stdlib in contrast to #15828 (#15830)
* remove iup from stdlib

* Update changelog.md
2020-11-03 20:43:51 +01:00
flywind
75dc69417a fix deprecated messages regarding high (#15832) 2020-11-03 16:31:16 +01:00
cooldome
d62f3627aa EnumUtils, speed up findStr in compiler (#15777)
* add parseEnumRange
* fix runnable example
* update changelog
* use parseEnumRange in compiler
* reorganise code
* add changelog, make single normalizer argument
2020-11-03 16:26:16 +01:00
flywind
b8bcf236dd fix #12640 (#15829) 2020-11-03 11:41:41 +01:00
flywind
fde17b159f follow #15818 and close #7109 (#15823)
* follow #15818 and close #7109

* Update compiler/jsgen.nim

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

Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>
2020-11-02 18:27:39 +01:00
Miran
c243639979 ioutils are moved to fusion (#15822) 2020-11-02 16:52:54 +01:00
Timothee Cour
235e4930ab simplify toHex (#15821) 2020-11-02 14:48:36 +01:00
Andreas Rumpf
dfd8a83f35 fixes #15804 (#15820)
* fixes #15804

* fix the existing test

* add the testcase for #15804

Co-authored-by: narimiran <narimiran@disroot.org>
2020-11-02 14:17:09 +01:00
flywind
eb429988cd fixes #15594 (#15819) 2020-11-02 14:16:33 +01:00
Regis Caillaud
6fa82a5b3a Handle BLOB column type in SQLite as binary data (#15681)
* Fixed not handling blob correctly in sqlite
* Fixed setLen commented by mistake
* Added binary example as db_sqlite doc
* Added tests for sqlite binary data
2020-11-02 13:02:55 +01:00
flywind
4fe56b56ce more clear (#15812) 2020-11-02 13:01:19 +01:00
flywind
5b4c17b5e7 Closure iterators are not supported by VM (#15818) 2020-11-02 10:58:14 +01:00