Commit Graph

21592 Commits

Author SHA1 Message Date
ringabout
02ba28eda5 iNim switch to the official URL (#22762)
ref https://github.com/inim-repl/INim/pull/139
2023-09-27 14:35:41 +08:00
Juan Carlos
21218d743f Documentation only (#22761)
- Mention Bisect bot in Bisect documentation.
2023-09-27 05:49:17 +02:00
ringabout
a7a0cfe8eb fixes #10542; suppresses varargs conversion warnings (#22757)
fixes #10542
revives and close #20169
2023-09-26 14:05:18 +02:00
Jake Leahy
435f932088 Add test case for #15351 (#22754)
Closes #15351

Stumbled across the issue and found it now works
2023-09-26 17:40:18 +08:00
ringabout
46544f234d fixes stint CI (#22756) 2023-09-26 17:39:59 +08:00
ringabout
3979e83fcb fixes #22706; turn "unknown hint" into a hint (#22755)
fixes #22706
2023-09-25 17:51:30 +02:00
Amjad Ben Hedhili
f0bf94e531 Make newStringUninit available in the VM [backport] (#22748)
It's equivalent to `newString`.
2023-09-25 07:19:09 +02:00
Juan Carlos
5840101968 Update Bisect (#22750)
- Support multiple OS Bisects (Linux, Windows, MacOS).
- Install Valgrind only if needed to speed up non-Valgrind builds.
- Valgrind+MacOS bisect support.
- Show IR of OK repro code samples.
- YAML only, tiny diff.


#### New features

- Bisect bugs that only reproduce on Windows and OSX.


#### See also

- https://github.com/juancarlospaco/nimrun-action/pull/10
2023-09-25 11:21:09 +08:00
SirOlaf
1b0447c208 Add magic toOpenArrayChar (#22751)
Should help with stuff like the checksums package which only takes
`openArray[char]`

Co-authored-by: SirOlaf <>
2023-09-24 20:47:56 +02:00
Amjad Ben Hedhili
a6c281bd1d Fix newStringUninit not setting the '\0' terminator [backport] (#22746)
Causes problems when working with `cstring`s.
2023-09-23 17:08:24 +02:00
Amjad Ben Hedhili
eadd0d72cf Initialize newString in js [backport:1.6] (#22745)
```nim
echo newString(8)
```

results in:
```
D:\User\test.js:25
                  var code_33556944 = c_33556931.toString(16);
                                                 ^

TypeError: Cannot read properties of undefined (reading 'toString')
    at toJSStr (D:\User\test.js:25:50)
    at rawEcho (D:\User\test.js:70:16)
    at Object.<anonymous> (D:\User\test.js:101:1)
    at Module._compile (node:internal/modules/cjs/loader:1095:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47

Node.js v17.0.1
Error: execution of an external program failed: '"C:\Program Files\nodejs\node.exe" --unhandled-rejections=strict D:\User\test.js'
```
2023-09-23 16:10:17 +02:00
Amjad Ben Hedhili
b10a809274 Make newStringUninit available on the js backend [backport] (#22743) 2023-09-23 11:39:11 +02:00
ringabout
c0838826c0 fixes #22519; DocGen does not work for std/times on JS backend (#22738)
fixes #22519
2023-09-22 11:38:30 +08:00
ringabout
a1b6fa9420 fixes #22246; generate __builtin_unreachable hints for case defaults (#22737)
fixes #22246
resurrects #22350
2023-09-21 19:47:29 +02:00
Juan M Gómez
c75cbdde70 moves addUnique to std/sequtils (#22734)
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-09-21 13:56:00 +02:00
Juan Carlos
b289617013 Documentation only (#22735)
- Add Atomic ARC to Documentation. Documentation only, tiny diff.
2023-09-21 09:05:23 +02:00
ringabout
ed30692d29 fixes #22687; js backend - std/bitops/bitsliced throws compile error … (#22722)
…in typeMasked

fixes #22687
2023-09-21 00:35:48 +02:00
ringabout
d82bc0a29f items, pairs and friends now use unCheckedInc (#22729)
`{.push overflowChecks: off.}` works in backends. Though it could be
implemented as a magic function.

By inspecting the generated C code, the overflow check is eliminated in
the debug or release mode.


![image](https://github.com/nim-lang/Nim/assets/43030857/49c3dbf4-675e-414a-b972-b91cf218c9f8)

Likewise, the index checking is probably not needed.
2023-09-20 12:50:23 +02:00
Juan M Gómez
af617be67a removes references to this in the constructor section (#22730) 2023-09-20 12:02:55 +02:00
Juan M Gómez
fefde3a735 fixes compiler crash by preventing exportc on generics (#22731)
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-09-20 08:19:29 +02:00
Juan M Gómez
5568ba0d9f constructor now uses result instead of this (#22724) 2023-09-19 21:16:55 +02:00
metagn
81756d1810 second test case haul for templates and generics (#22728)
closes #8390, closes #11726, closes #8446, closes #21221, closes #7461,
closes #7995
2023-09-19 15:26:26 +08:00
metagn
51cb493b22 make parseEnum skip type aliases for enum type sym (#22727)
fixes #22726
2023-09-19 09:14:55 +02:00
Amjad Ben Hedhili
b542be1e7d Fix capacity for const and shallow [backport] (#22705) 2023-09-18 22:57:30 +02:00
ringabout
2c5b94bbfd fixes #22692; ships ci/funs.sh (#22721)
fixes #22692
2023-09-18 22:57:03 +02:00
sls1005
dba9000609 Add descriptions and examples for rawProc and rawEnv (#22710)
Add descriptions for `rawProc` and `rawEnv`. See
<https://forum.nim-lang.org/t/10485> for more informations.

---------

Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-09-18 16:42:43 +02:00
litlighilit
741285b335 Update osfiles.nim, make moveFile consider permission on *nix (#22719)
see https://github.com/nim-lang/Nim/issues/22674
2023-09-18 13:15:17 +02:00
ringabout
63c2ea5566 fixes incorrect cint overflow in system (#22718)
fixes #22700
2023-09-18 10:00:46 +02:00
ringabout
deefbc420e fixes result requires explicit initialization on noReturn code (#22717)
fixes #21615; fixes #16735

It also partially fixes | #22673, though It still gives 'baseless'
warnings.
2023-09-18 08:28:40 +02:00
Juan M Gómez
bd857151d8 prevents declaring a constructor without importcpp fixes #22712 (#22715)
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-09-18 08:26:21 +02:00
metagn
5f9038a5d7 make expressions opt in to symchoices (#22716)
refs #22605

Sym choice nodes are now only allowed to pass through semchecking if
contexts ask for them to (with `efAllowSymChoice`). Otherwise they are
resolved or treated as ambiguous. The contexts that can receive
symchoices in this PR are:

* Call operands and addresses and emulations of such, which will subject
them to overload resolution which will resolve them or fail.
* Type conversion operands only for routine symchoices for type
disambiguation syntax (like `(proc (x: int): int)(foo)`), which will
resolve them or fail.
* Proc parameter default values both at the declaration and during
generic instantiation, which undergo type narrowing and so will resolve
them or fail.

This means unless these contexts mess up sym choice nodes should never
leave the semchecking stage. This serves as a blueprint for future
improvements to intermediate symbol resolution.

Some tangential changes are also in this PR:

1. The `AmbiguousEnum` hint is removed, it was always disabled by
default and since #22606 it only started getting emitted after the
symchoice was soundly resolved.
2. Proc setter syntax (`a.b = c` becoming `` `b=`(a, c) ``) used to
fully type check the RHS before passing the transformed call node to
proc overloading. Now it just passes the original node directly so proc
overloading can deal with its typechecking.
2023-09-18 06:39:22 +02:00
SirOlaf
fcf4c1ae17 Fix #22713: Make size unknown for tyForward (#22714)
Close #22713

---------

Co-authored-by: SirOlaf <>
2023-09-17 20:03:43 +02:00
metagn
8836207a4e implement semgnrc for tuple and object type nodes (#22709)
fixes #22699
2023-09-16 09:16:12 +02:00
Juan M Gómez
cd0d0ca530 Document C++ Initializers (#22704)
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-09-15 12:08:41 +02:00
Juan Carlos
ae0a3f65c6 Fix Bisect bot (#22703)
-
https://github.com/nim-lang/Nim/actions/runs/6187256704/job/16796720625#step:4:29
- https://github.com/nim-lang/Nim/issues/22699
2023-09-14 20:43:45 +02:00
Amjad Ben Hedhili
38b58239e8 followup of #22568 (#22690) 2023-09-14 17:38:33 +02:00
Juan M Gómez
96e1949610 implements RFC: [C++] Constructors as default initializers (#22694)
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-09-14 17:37:30 +02:00
metagn
ac1804aba6 refactor semtempl ident declarations, some special word use (#22693)
`semtempl` is refactored to combine the uses of `getIdentNode`,
`onlyReplaceParams`, `isTemplParam` and most of `replaceIdentBySym` into
a single `getIdentReplaceParams` proc. This might fix possible problems
with injections of `nkAccQuoted`.

Some special word comparison in `ast` and `semtempl` are also made more
efficient.
2023-09-14 06:22:22 +02:00
Amjad Ben Hedhili
325341866f Make capacity work with refc [backport] (#22697)
followup of #19771.
2023-09-13 20:43:25 +02:00
Andreas Rumpf
8f5b90f886 produce better code for object constructions and 'result' [backport] (#22668) 2023-09-11 18:48:20 +02:00
Juan M Gómez
7e86cd6fa7 fixes #22680 Nim zero clear an object inherits C++ imported class when a proc return it (#22684) 2023-09-11 12:55:11 +02:00
ringabout
b1a8d6976f fixes the discVal register is used after free in vmgen (#22688)
follow up https://github.com/nim-lang/Nim/pull/11955
2023-09-11 10:54:41 +02:00
Amjad Ben Hedhili
fbb5ac512c Remove some unnecessary initialization in seq operations (#22677)
* `PrepareSeqAdd`
* `add`
* `setLen`
* `grow`

Merge after #21842.

---------

Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
2023-09-10 17:36:49 +02:00
ringabout
f8f6a3c926 renderIr should print the actual return assign node (#22682)
follow up https://github.com/nim-lang/Nim/pull/10806

Eventually we need a new option to print high level IR. It's confusing
when I'm debugging the compiler without showing `return result = 1`
using the expandArc option.

For 
```nim
proc foo: int =
  return 2
```
It now outputs when expanding ARC IR
```nim
proc foo: int =
  return result = 2
```
2023-09-10 17:35:40 +02:00
Juan M Gómez
8032f252b2 fixes #22669 constructor pragma doesnt init Nim default fields (#22670)
fixes #22669 constructor pragma doesnt init Nim default fields

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-09-10 12:45:36 +02:00
Juan M Gómez
cd24195d44 fixes #22679 Nim zero clear an object contains C++ imported class when a proc return it (#22681) 2023-09-10 12:30:03 +02:00
ringabout
2ce9197d3a [minor] merge similar branches in vmgen (#22683) 2023-09-10 10:43:46 +02:00
Amjad Ben Hedhili
8853fb0775 Make newSeqOfCap not initialize memory. (#21842)
It's used in `newSeqUninitialized`.

---------

Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
2023-09-09 21:11:45 +02:00
ringabout
5717a4843d fixes #22676; remove wMerge which is a noop for more than 8 years (#22678)
fixes #22676

If csource or CI forbids it, we can always fall back to adding it to the
nonPragmaWords list. I doubt it was used outside of the system since it
was used to implement & or something for magics.
2023-09-09 17:25:48 +02:00
Juan M Gómez
e6ca13ec85 Instantiates generics in the module that uses it (#22513)
Attempts to move the generic instantiation to the module that uses it.
This should decrease re-compilation times as the source module where the
generic lives doesnt need to be recompiled

---------

Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-09-09 10:34:20 +02:00