Commit Graph

21307 Commits

Author SHA1 Message Date
metagn
b35942ef83 fix new type inference for noreturn [backport] (#22182)
fixes #22180

Backported since apparently the new type inference was backported
2023-06-28 22:38:08 +02:00
Juan M Gómez
d195877615 docs nimBasePattern (#22179) 2023-06-28 17:49:35 +02:00
Andreas Rumpf
427ad17161 fixes #22001 (#22177)
* fixes #22001

* added test case
2023-06-27 22:42:48 +02:00
Andreas Rumpf
9616762cfe Revert "fix struct stat" (#22171)
Revert "fix struct stat (#22161)"

This reverts commit 4b761295e7.
2023-06-27 16:46:41 +02:00
Andreas Rumpf
ce0909f047 fixes #22137 (#22170) 2023-06-27 14:58:02 +02:00
Andreas Rumpf
faa59b1e1f Use pinned Atlas commit (#22169) 2023-06-27 14:12:21 +02:00
ringabout
e422b3c860 adds =destroy T support for strings and seqs (#22167)
* adds =destroy T support for strings and seqs

* fixes system

* fixes tests
2023-06-27 13:07:29 +02:00
Andreas Rumpf
d52b1d848e destructors: update, =destroy does not require a 'var T' (#22168) 2023-06-27 12:55:47 +02:00
Jacek Sieka
47635d3031 fix Sigaction struct definition (#22160)
SigInfo is still wrong (most of its fields are in a union)
2023-06-27 10:09:04 +02:00
Jacek Sieka
cb40f11e6c uint arithmetic for pointers (#22159)
pointers are not signed and arithmetic may correctly cross int.max
threshold

this PR only fixes 2 occurances - there are plenty however in the std
lib
2023-06-27 08:20:02 +02:00
Jacek Sieka
4b761295e7 fix struct stat (#22161)
Undo damage of https://github.com/nim-lang/Nim/pull/14170
2023-06-27 08:19:17 +02:00
ringabout
4ce3a68e79 fixes #22163; use {.push warning[BareExcept]:off.} to override settings temporarily (#21390)
* use `{.push warning[BareExcept]:off.}` to override settings temporarily

* likewise, suppress expect
2023-06-27 08:03:52 +08:00
ringabout
4546f5dfe5 adds T destructor for refs (#22147)
* adds T destructor for refs

* add `newRefdestructor`

* adds ref overload for destructors

* fixes config
2023-06-26 15:10:06 +02:00
Jake Leahy
43a3de9077 Fix regression in std/times (#22155)
* Add simple test case

Just so the regression doesn't happen again

* Specify initDateTime is gcsafe in the forward declarations
2023-06-26 15:07:42 +02:00
tersec
3e44d5742f rm zero-extension and uint conversions deprecated since 0.19.9 (#22151) 2023-06-25 20:37:21 +02:00
ringabout
942c378659 fixes #22148; std/memfiles.memSlices nesting now fails with memory sa… (#22154)
* fixes #22148; std/memfiles.memSlices nesting now fails with memory safety capture violation

* adds a test case
2023-06-25 17:15:47 +02:00
metagn
20037a4749 make var object match better than object (#22152)
* fix `var object` not matching better than `object`

fixes #13302

* remove comment for brevity

* try note

* try minimize breaks
2023-06-25 16:52:16 +02:00
metagn
f718f295df fix VM uint conversion size bug, stricter int gen on JS (#22150)
* fix VM uint conversion bug, stricter int gen on JS

fixes #19929

* fix float -> uint64 conversion too

* no need to mask to source type

* simpler diff with explanation, add test for described issue
2023-06-25 00:01:08 +02:00
Etan Kissling
c6c85f84db macOS ar doesn't support @ syntax (#22146)
When the linker command line is long, Nim compiler generates a file for
passing the linker arguments. On `macOS`, that mechanism fails as the
`@` syntax is not supported by `ar`. Use `xargs` instead to pass the
linker arguments file.
2023-06-24 08:13:43 +02:00
Juan M Gómez
beaac609ab adds nimbasePattern compiler option (#22144)
adds optonal --nimbasepattern
2023-06-24 08:13:15 +02:00
ringabout
88114948c4 fixes #21110; duplicate proc definitions for inline iters (#21136)
fixes #21110; duplicate proc definitions for iters
2023-06-22 22:17:23 +02:00
ringabout
d137a3b52a fixes :idx: index in in modules (2.0 regression) and in markdown files (persistent issues since 0.20.2) (#22141)
fixes :idx: index
2023-06-22 15:58:10 +02:00
ringabout
ac7b8b678c fixes #21231; template with module as parameter elides usage/checking of module name specifier (#22109)
* fixes #21231; template with module as parameter elides usage/checking of module name specifier

* add a test case
2023-06-21 16:30:55 +02:00
ringabout
eb2f0353bc adds missing staticlib hints (#22140) 2023-06-21 16:30:23 +02:00
Bung
3ad2e7df1c fix #20023 hash for generic tables (#20346)
* fix #20023 hash for generic tables

* use default computation

* Update lib/pure/collections/tables.nim

Co-authored-by: Dan Rose <dan@digilabs.io>

* Update lib/pure/collections/tables.nim

Co-authored-by: Dan Rose <dan@digilabs.io>

* Update lib/pure/collections/tables.nim

* Update lib/pure/collections/tables.nim

* Update t20023.nim

---------

Co-authored-by: Dan Rose <dan@digilabs.io>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-06-21 12:19:40 +02:00
Juan M Gómez
ede03782a3 Update changelog_2_0_0.md (#22135) 2023-06-21 11:41:40 +02:00
Zoom
5e529b3bfa strutils.split/rsplit now return src on an empty sep (#22136)
This is a rebase of an earlier rejected PR. Following the discussion
around it, this commit provides a valid output for and edge case
of an empty separator for `split` and `rsplit` routines. The empty
separator is interpreted as "split by no separators" and the initial
string is returned. This is consistent with the behaviour of the
`set[char]` version of `split`/`rsplit` routines and unifies them all.

Compared to a commit merged earlier, this one has a benefit of
not using assertions that will be removed in release builds
and thus still not preventing possible infinite loops (which was the
earlier behaviour for this edge case for separator of type `string`).

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-06-21 08:52:33 +02:00
ringabout
a345cde26e allow destructors to accept non var parameters; deprecate proc =destroy(x: var T) (#22130)
* make destructors accept non var parameters
* define nimAllowNonVarDestructor
* add a test case and a changelog
* update documentation and error messages
* deprecate destructors taking 'var T'
2023-06-21 08:51:03 +02:00
Ryan McConnell
db41f04ab0 Amend divmod (#22131)
* Add Overflow checks & test adjust

* Avoiding nimvm differences in tests

* distinguish DivByZeroDefect
2023-06-20 13:04:34 +02:00
ringabout
f524d60fa1 fixes #22123; Compiler bug with default initializer values and arrays (#22128) 2023-06-20 08:02:06 +02:00
ringabout
29a43124cf overhaul the error messages of =dup (#22129) 2023-06-20 07:08:39 +02:00
ringabout
2054f1c3a9 fixes #22117; View types lifetime tracking does not work with defer (#22121) 2023-06-19 15:23:51 +02:00
Ivan Yonchovski
2bb7277a61 Create compiler and nimsuggest packages (#22118)
I have tested it locally with the following in my local packages_official.json

```
  {
    "name": "compiler",
    "url": "https://github.com/yyoncho/Nim.git/?subdir=compiler",
    "method": "git",
    "tags": [
      "library",
      "compiler"
    ],
    "description": "Package providing the Nim compiler binaries plus all its source files that can be used as a library",
    "license": "MIT",
    "web": "https://github.com/nim-lang/Nim"
  },
  {
    "name": "nimsuggest",
    "url": "https://github.com/yyoncho/Nim.git/?nimsuggest=compiler",
    "method": "git",
    "tags": [
      "library",
      "compiler"
    ],
    "description": "Package providing the Nim compiler binaries plus all its source files that can be used as a library",
    "license": "MIT",
    "web": "https://github.com/nim-lang/Nim"
  },
```

Then `nimble install compiler`, `nimble install nimsuggest` work as expected.
2023-06-18 16:06:14 +02:00
metagn
6d21637245 fix scoping regression with calls in generic bodies (#22115)
refs #22029, refs https://github.com/status-im/nim-libp2p/actions/runs/5263850340/jobs/9514434659
2023-06-17 15:24:32 +08:00
Ryan McConnell
647d9611ae Add divmod (#22102)
* Adding divmod

* Adding support to VM

* Wrapped C structs and funcs

* Fix javascript impl

* Fixing struct compat

* Segregate tests, better compiletime defs

* Using `inline` and switch back to `func`

* Apply suggestions from code review

* Explicit structures

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-06-17 05:42:05 +02:00
Andreas Rumpf
e8d0f1c3ae fixes #16331; aliasing of tuple construction within a single assignme… (#22113)
* fixes #16331; aliasing of tuple construction within a single assignment, great coding style

* added test case
2023-06-16 20:59:59 +02:00
metagn
0de9e6bbf3 add test to close #7209 (#22110)
* add test to close #7209

was fixed by #22029

* fix echo => doAssert
2023-06-16 20:20:06 +02:00
Andreas Rumpf
8c3b0e9b48 added new experimental API isUniqueRef (#21812)
* added new experimental API isUniqueRef

* typo
2023-06-16 19:35:16 +02:00
Miran
7ea8f1d5dd bump NimVersion to 1.9.5 (#22112) 2023-06-16 17:20:28 +02:00
metagn
88388040db add tests to close #7223, close #11733 (#22111)
add test to close #7223, close #11733

closes #7223, closes #11733, were fixed by #22076
2023-06-16 17:14:47 +02:00
ringabout
77beb15214 fixes #22049; fixes #22054; implicit conversion keeps varness (#22097)
* fixes #22054; codegen for var tuples conv

* rethink fixes

* add test cases

* templates only

* fixes var tuples

* keep varness no matter what

* fixes typ.isNil

* make it work for generics

* restore isSubrange

* add a test case as requested
2023-06-16 12:06:50 +02:00
Andreas Rumpf
0750210a50 fixes #19607 (#21576) 2023-06-16 12:06:18 +02:00
metagn
3ac2d81601 consider object types as declarative in templates (#22106)
* consider object types as declarative in templates

fixes #16005

* correct logic for nkRecList children, inject fields

* don't actually inject fields
2023-06-16 08:38:48 +02:00
Juan M Gómez
b4d9be0f8a fixes ilegal recursion (#22105) 2023-06-16 08:23:25 +02:00
Juan Carlos
0a19d78b22 Revert the .inline semantics change (#22104) 2023-06-15 21:09:33 +02:00
Juan M Gómez
4937aa952b adds another pass for sets fixes #6259 (#22099)
* adds another pass for sets fixes #6259

* Update tsets.nim

removes extra `#`
2023-06-15 18:50:00 +02:00
ringabout
edb64bcff4 fixes explicit deref block (#22093)
fixes explicit deref
2023-06-15 09:56:58 +02:00
Juan M Gómez
d90581c677 Allows for arbitrary ordering of inheritance in type section #6259 (#22070)
* Allows for arbitrary ordering of inheritance in type section #6259

* prevents ilegal recursion

* fixes ilegal recursion. Test passes with a better message

* Apply suggestions from code review

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-06-15 09:56:08 +02:00
metagn
13b7e4e0e5 use TimeInterval instead of Duration for calculating ISO week date (#22091)
* use TimeInterval instead of Duration for calculating ISO week date

hopefully actually fixes (space) #22059

* forward declare

* explicit effects
2023-06-14 20:43:46 +02:00
ringabout
44f377edaf imrpove changelog (#22096)
Update changelog_2_0_0.md
2023-06-14 13:10:24 +02:00