Commit Graph

22509 Commits

Author SHA1 Message Date
Skylar Ray
dcc4e07e54 chore: docs fix spelling issues (#24581)
**handle - handles**
**sensitiviy - sensitivity**
2024-12-30 19:40:45 +08:00
futreall
0df351bf50 chore: correct typos docs (#24580) 2024-12-28 16:24:46 +01:00
Antonis Geralis
d3b6dba616 Consider iterator types (#24577)
According to the macros doc nnkIteratorTy trees use the same structure
as nnkProcTy
2024-12-28 09:25:49 +01:00
Antonis Geralis
e1be29942e Support tuple parameter types (#24576) 2024-12-28 08:43:41 +01:00
chloefeal
cd220fe3e1 docs: fix typos (#24573)
Signed-off-by: chloefeal <188809157+chloefeal@users.noreply.github.com>
2024-12-27 19:42:18 +01:00
Jake Leahy
86d6f71f5a Doc search improvements (#24567)
- `/` is now a hotkey to jump to the search
- Search results now are in line with the page (previously on small
screens it would be off centre)
- Jumping to a search result inside the page or via TOC will now hide
the search results (previously the results got in the way)

Example site here: https://tranquil-scone-c159b6.netlify.app/main.html
2024-12-25 14:19:22 +01:00
Jake Leahy
5b9ff963c5 Minor std/strscans improvements (#24566)
#### Removes UnInit warnings when using `scanTuple` 

e.g. this would emit a warning
```nim
import std/strscans

proc main() =
  let (ok, number) = "123".scanTuple()
```

![image](https://github.com/user-attachments/assets/68170ac6-402d-48b0-b8b6-69e71f4b70ae)

#### Error for wrong type now points to the passed in variable

```nim
import std/strscans

var str: string
discard "123".scanf("$i", str)
```

it gave this warning before

![image](https://github.com/user-attachments/assets/096e56d2-0eb5-4c67-9725-25caa97afebd)
now it returns

![image](https://github.com/user-attachments/assets/736a4292-2f56-4cf3-a27a-677045377171)
2024-12-25 09:27:12 +01:00
ringabout
65b26401bc adds a test case (#24565)
closes #19531
2024-12-25 09:26:06 +01:00
Esteban C Borsani
2f127bf99f Improve async stacktraces (#24563)
This makes await point to the caller line instead of asyncmacro. It also
reworks the "Async traceback:" section of the traceback. Follow up PR
#21091 (issue #19931) so it works if there is asynchronous work done.
2024-12-25 09:25:28 +01:00
ringabout
3c4246dd24 fixes #23114; Nim v2 regression emit / asm var param dereference inconsistency (#24547)
fixes #23114

As in https://github.com/nim-lang/Nim/pull/22074, expressions in
bracketed emit are strictly typechecked, this PR applies the same check
for symbols in asm statements in order to keep them consistent.
2024-12-25 09:23:25 +01:00
Tomohiro
fc806710cb Add inline assembler tests for i386, arm, arm64, riscv32 and riscv64 (#24564)
This fixes one error in https://github.com/nim-lang/Nim/issues/24544 .
I tested this on Raspberry Pi Pico (arm) and Raspberry Pi 3(arm64).
It is not tested on i386, riscv32 and riscv64 CPU.
2024-12-24 23:11:19 +08:00
ringabout
e2a306355c adds a test case (#24561)
closes #18616
2024-12-23 21:03:18 +08:00
metagn
5c71fbab30 fix jsonutils with generic sandwiches, don't use strformat (#24560)
fixes #24559

The strformat macros have the problem that they don't capture symbols,
so don't use them in the generic `fromJson` proc here. Also `fromJson`
refers to `jsonTo` before it is declared which doesn't capture it, so
it's now forward declared.
2024-12-23 06:08:46 +01:00
Jake Leahy
6bc52737b3 Make 'field is not accessible' and 'field initialized twice' errors point to the field inside the obj construction (#24557)
Fixes two line infos to make the error's clearer inside editors

- 'field is not accessible' would point to the whole object construction
instead of just the field inside the construction
- 'field initialized twice' would point to the colon instead of the
field
2024-12-22 14:25:36 +01:00
Esteban C Borsani
f29234b40f fixes #23212; Asyncdispatch leaks under --mm:arc (#24556)
Fixes #23212

Inspired by [this chronos
PR](https://github.com/status-im/nim-chronos/pull/243)
2024-12-22 07:56:22 +01:00
ringabout
63c884038d remove zippy data from tarballs (#24551)
fixes https://github.com/nim-lang/nightlies/issues/95
2024-12-20 22:09:29 +01:00
metagn
986ca7dcd4 check if unused import warning is enabled before adding import to stack (#24554)
fixes #24552

Could also implement `{.used.}` for imports but this wouldn't be
backwards compatible. The same problem as #24552 also exists for
`{.hint[XDeclaredButNotUsed].}` but this isn't as much of a problem
since `{.used.}`/`{.push used.}` exist.
2024-12-20 22:09:03 +01:00
Daniel Stuart
50ed43df42 Use long int builtins for risc-v 32-bit targets (#24553)
Solves compilation using riscv32-unknown-elf-gcc, compiler defines
int32_t as long int.
2024-12-20 21:27:37 +03:00
ringabout
ce4304ce97 fixes strictdefs warnings (#24550) 2024-12-20 15:26:30 +01:00
Jake Leahy
f80ce139d5 Make expandMacro show private fields (#24522)
Was debugging with `--expandMacro` and noticed that private fields
weren't exported.
Passes extra flags to the renderer to make them be shown
2024-12-17 18:17:04 +01:00
ringabout
d5c7abe3d2 fixes #17681; enforce codegen for exportc consts (#24546)
fixes #17681
2024-12-17 18:16:34 +01:00
Juan M Gómez
8ce58fab26 Adds skipParentCfg back. Bump nimble to a commit where it doesnt rely in the parent config (#24545) 2024-12-17 18:15:48 +01:00
ringabout
70b3232d3a fixes #24536; fixes nightlies regression caused by nimble update (#24542)
follow up #24537

Because `nimble` is a bundled repo so it is bundled in the tarballs

i.e.
82421fd705/.github/workflows/nightlies.yml (L264)
has bundled `dist/nimble`, but it only copies the data without `.git`.
So in this PR, we ignore bundled nimble repo.
2024-12-17 06:42:17 +01:00
ringabout
81d8c0fc17 fixes #20908; Unknown warnings and hints now give a warning (#24543)
fixes #20908

This PR unifies the treatment of unknown warnings and hints, which now
gives an `warnUnknownNotes` instead of an error.
2024-12-17 06:41:38 +01:00
ringabout
91d1933ea2 fixes #24538 (#24541)
fixes #24538
2024-12-16 15:25:44 +01:00
metagn
b9c593404c proper error for const defines with unsupported types (#24540)
fixes #24539
2024-12-16 12:22:10 +01:00
Juan M Gómez
556f217b4c #Fixes #24536 building nimble 0.16.4 fails when running build_all.sh (#24537) 2024-12-16 08:05:00 +01:00
ringabout
d31cce557b more strictdef fixes for stdlibs (#24535) 2024-12-13 19:06:43 +01:00
Juan M Gómez
be4d19e562 Bumps nimble v0.16.4 (#24437) 2024-12-13 19:00:18 +01:00
Ryan McConnell
e0197a8380 couple cases of valid concept bindings (#24513)
see tests

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2024-12-13 15:13:19 +01:00
ringabout
d2d810585c fixes strictdefs warnings continue (#24520) 2024-12-13 15:04:49 +01:00
ringabout
80af252025 adds a test case (#24534)
closes #16845
2024-12-13 19:30:53 +08:00
bptato
f485973459 Fix exitnow signature, mark as .noreturn (#24533)
Like quit, this function never returns.

Also, "code" was marked as "int", even though POSIX _exit takes a C int.
2024-12-12 22:57:10 +01:00
ringabout
f7a461a30c fixes #22101; std/pegs with nim cpp --mm:orc --exceptions:goto creates invalid C++ (#24531)
fixes #22101

The old implementation generates

`auto T = value;` for the cpp backend which causes problems for goto
exceptions. This PR puts the declaration of `T` to the cpsLocals parts
and makes it compatible with goto exceptions.
2024-12-12 22:56:41 +01:00
ringabout
f796c01e3c adds a test case (#24532)
closes #18070
2024-12-12 22:30:54 +08:00
ringabout
9bb7e53e7f fixes #22153; UB calling allocCStringArray([""]) with --mm:refc (#24529)
fixes #22153

It's a problem for refc because you cannot index a nil string: i.e.
`[""]` is `{((NimStringDesc*) NIM_NIL)}` which cannot be indexed
2024-12-11 21:02:24 +01:00
Jake Leahy
da9f7f671b Make error appear in user code with invalid format string in strformat (#24528)
With this example
```nim
import std/strformat

echo fmt"{invalid, code}"
```

We get the error message
```
stack trace: (most recent call last)
/home/jake/.choosenim/toolchains/nim-hashdevel/lib/pure/strformat.nim(750, 16) fmt
/home/jake/.choosenim/toolchains/nim-hashdevel/lib/pure/strformat.nim(714, 16) strformatImpl
/home/jake/Documents/projects/Nim/temp.nim(3, 9) template/generic instantiation of `fmt` from here
/home/jake/.choosenim/toolchains/nim-hashdevel/lib/pure/strformat.nim(714, 16) Error: could not parse `invalid, code` in `{invalid, code}`.
(1, 8) Error: invalid indentation
```
After PR it now shortens it to just appear in user code
```
/home/jake/Documents/projects/Nim/lib/pure/strformat.nim(750, 16) fmt
/home/jake/Documents/projects/Nim/lib/pure/strformat.nim(714, 16) strformatImpl
/home/jake/Documents/projects/Nim/temp.nim(3, 9) Error: could not parse `invalid, code` in `{invalid, code}`.
(1, 8) Error: invalid indentation
```
2024-12-11 21:01:57 +01:00
Jake Leahy
69e0cdb6c0 Fix line info for import (#24523)
Refs #24158


Fixes the line info of the module symbol (cases like `import as` and
grouped imports had wrong line info). Since that symbol's line info is
now used for the warnings, there isn't a separate line info stored for
`unusedImports`

Examples of fixed cases
```nim
import strutils as test #[
                ^ before
                   ^ after ]#

# This case was fixed by #24158, but only for unused imports
import std/[strutils, strutils] #[
        ^ before
                      ^ after ]#

from strutils import split #[
^ before 
     ^ after ]#
```
2024-12-11 20:55:55 +01:00
metagn
b529f69518 fix nil node in sym ast of exported ref objects [backport:2.2] (#24527)
fixes #24526, follows up #23101

The `shallowCopy` calls do not keep the original node's children, they
just make a new seq with the same length, so the `Ident "*"` node from
the original postfix nodes was not carried over, making it `nil` and
causing the segfault.
2024-12-10 13:20:40 +01:00
metagn
aeb3fe9505 test case haul to prevent pileup (#24525)
closes #6013, closes #7009, closes #9190, closes #12487, closes #12831,
closes #13184, closes #13252, closes #14860, closes #14877, closes
#14894, closes #14917, closes #16153, closes #16439, closes #17779,
closes #18074, closes #18202, closes #18314, closes #18648, closes
#19063, closes #19446, closes #20065, closes #20367, closes #22126,
closes #22820, closes #22888, closes #23020, closes #23287, closes
#23510
2024-12-09 08:11:47 +01:00
ringabout
d408b94063 fixes nightlies regression (#24519)
follows up https://github.com/nim-lang/Nim/pull/24507
2024-12-07 06:35:47 +01:00
ringabout
801733f286 adds a test case (#24518)
closes #19698
2024-12-06 20:19:57 +08:00
metagn
6f4106bf5d track call depth separately from loop count in VM (#24512)
refs #24503

Infinite recursions currently are not tracked separately from infinite
loops, because they also increase the loop counter. However the max
infinite loop count is very high by default (10 million) and does not
reliably catch infinite recursions before consuming a lot of memory. So
to protect against infinite recursions, we separately track call depth,
and add a separate option for the maximum call depth, much lower than
the maximum iteration count by default (2000, the same as
`nimCallDepthLimit`).

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2024-12-06 19:00:59 +08:00
ringabout
c0861142f8 fixes strictdefs warnings for stdlibs [part two] (#24514)
After some cleanups for stdlibs, then we should enable warningaserror
for all tests
2024-12-06 05:40:48 +01:00
ringabout
d0288d3b57 fixes #24504; fixes ensureMove for refs (#24505)
fixes #24504
2024-12-05 21:37:21 +01:00
ringabout
02fb0476ce adds a test case (#24515)
closes #17733
2024-12-05 22:19:34 +08:00
ringabout
2e9e7f13ee don't track result initialization if it is marked noinit (#24499)
We don't track `noinit` for variables introduced in
https://github.com/nim-lang/Nim/pull/10566. It should be applied to
`result` if the function is marked `noinit`
2024-12-04 15:12:30 +01:00
Tomohiro
bbf6a62c90 fixes #24506; calculate timeout correctly (#24507)
`curTimeout` is calculated incorrectly. So this PR fixes it.
This PR also replaces `now()` with `getMonoTime()`.
2024-12-04 15:11:32 +01:00
ringabout
6bbf9c3117 remove unnecessary await (#24501)
There is already a when condition, so `await` is not needed to split the
function
2024-12-04 12:03:12 +01:00
ringabout
8f4bfda5f4 fixes some strictdefs warnings (#24502) 2024-12-04 18:28:13 +08:00