7805 Commits

Author SHA1 Message Date
ringabout
0b3ddd4e47 Revert "fixes #22246; generate __builtin_unreachable hints for case defaults" (#22351)
Revert "fixes #22246; generate `__builtin_unreachable` hints for case defaults (#22350)"

This reverts commit b56df5c07f.
2023-07-31 22:14:15 +08:00
ringabout
b56df5c07f fixes #22246; generate __builtin_unreachable hints for case defaults (#22350)
* fixes #22246; generate `__builtin_unreachable` hints

* use elif

* indentation

* fixes holy enums in sim
2023-07-31 16:02:52 +02:00
Juan M Gómez
e70992d291 fixes an issue where byref wasnt properly handled when using it in a generic param (#22337)
* fixes an issue where byref wasnt properly handled when using it in a generic param

* removes unreachable check
2023-07-29 18:05:31 +02:00
ringabout
f0f3904ff0 implement ensureMove (#22339)
* implement `ensureMove`

* use an additional flag

* improve some logics

* progress: fixes discard ensureMove

* forbids nested expressions

* improve error messages

* checkpoint

* fixes cursor

* ADD MORE TESTS

* fixes cursorinference again

* tiny cleanup

* improve error messages

* fixes docs

* implement comments add more tests

* fixes js
2023-07-29 10:57:03 +02:00
konsumlamm
db77c98471 [JS] Fix bitwise ops & shifts (#22340)
* [JS] Fix bitwise ops & shifts

* Test `int64` & `uint64` only with `jsbigint64`
2023-07-27 23:06:30 +02:00
konsumlamm
c0994c2dbd [JS] Fix casting to ints (#22327)
* [JS] Fix casting to ints

* Simplify `genCast` by using `asUintN`/`asIntN`
2023-07-25 17:56:14 +02:00
ringabout
1c2ccfad08 fixes #22301; fixes #22324; rejects branch initialization with a runtime discriminator with defaults (#22303)
* fixes #22301; rejects branch initialization with a runtime discriminator with defaults

* undefault nimPreviewRangeDefault

* fixes tests

* use oldCheckDefault
2023-07-25 12:08:32 +02:00
Khaled Hammouda
dce714b259 Fix grammar top rule (#22325)
change stmt to complexOrSimpleStmt in the top grammar rule
2023-07-24 19:48:41 +02:00
ringabout
8216d7dd46 fixes #22321; fixes building DLL with --noMain still produces a DllMain (#22323)
* fixes #22321; Building DLL with --noMain produces an unexpected DllMain on devel branch

* remove implicit nomain
2023-07-24 17:22:50 +02:00
Juan M Gómez
49a108b302 Expands codegenDecl to work in function params. fixes #22306 (#22307)
* Expands codegenDecl to work in function params. fixes #22306

* makes the test more concrete so T{lit} params dont match

* adds sfCodegenDecl
2023-07-23 16:42:20 +02:00
Andreas Rumpf
be1844541c implemented 'push quirky' switch for fine grained control over the ex… (#22318)
* implemented 'push quirky' switch for fine grained control over the exception handling overhead

* documentation
2023-07-23 13:39:58 +02:00
SirOlaf
62869a5c68 Check try block for endsInNoReturn (#22314)
Co-authored-by: SirOlaf <>
2023-07-22 21:13:55 +02:00
konsumlamm
576f4a7348 Fix doc comment rendering for concepts (#22312) 2023-07-22 19:10:12 +02:00
SirOlaf
3ebe24977c Open scope for defer (#22315)
Co-authored-by: SirOlaf <>
2023-07-22 19:09:39 +02:00
ringabout
b02c1dd6ca fixes #22297; return in the finally in the closure iterators (#22300)
ref #22297; return in the finally in the closure iterators
2023-07-22 06:37:27 +02:00
Ryan McConnell
2f817ee5b4 infixArgument fail in renderer.nim sometimes (#22264)
* fixing minor typo

* Adding err msg
2023-07-20 19:56:54 +02:00
Jake Leahy
3f9e16594f fix jsondoc not getting showNonExports flag (#22267)
Pass the config down so we can check if the `--showNonExports` flag is used
2023-07-20 19:56:04 +02:00
Andreas Rumpf
c1a82aa5c5 minor code improvement (#22293) 2023-07-19 16:03:26 +02:00
ringabout
7d9fe106ec fixes #22268; fixes move codegen (#22288) 2023-07-19 12:57:58 +02:00
ringabout
1aff402998 fixes #6499; disallow built-in procs used as procvars (#22291) 2023-07-19 09:45:28 +02:00
Anna
14a9929464 Fix #22281 (#22289)
Respect `--gcc.exe` and similar options when `--genScript:on` is used.
2023-07-18 16:06:21 +02:00
ringabout
f16b94a9d7 extend the skipAddr for potential types for destructors (#22265)
extend the skipAddr for potential types
2023-07-18 16:05:05 +02:00
Jake Leahy
17915d93bf Fix non-toplevel fields in objects not getting rendered (#22266)
* Add example object into testproject

The proc is there to check the case of an identDef being inside an identDef (We do want to render those even if they are not exported)

* Add `inside` set to `TSrcGen` which allows us to see what context we are in

This is done instead of adding another inXyz bool parameter

We then use this to know if we are inside an object when rendering an nkIdentDefs (To know if we need to skip rendering it)

* Update test files
2023-07-16 19:46:18 +02:00
Juan M Gómez
50d435cd39 Fixes Naive virtual crash the compiler fixes #22269 (#22271)
* Fixes Naive virtual crash the compiler fixes #22269

* adds type specific test
2023-07-16 17:01:34 +02:00
ringabout
3b377937de gendepends now supports pkgs2 (#22277) 2023-07-14 12:40:24 +02:00
ringabout
ecc6ab7ee0 fixes #22237; fixes #21160; wrong cursor on unowned parameters in the for loop in ORC (#22240)
fixes #22237; fixes #21160; wrong cursor on unowned parameters
2023-07-10 10:31:13 +02:00
Jake Leahy
1b132ddaa2 Fix nimsuggest not showing suggestions for imported tuples (#22241)
* Add tests

Also test if exported all tuple fields works. This seems like a hacky solution so will try and dive further to find a better solution

* Always suggest tuple fields if it passes the filter

If the tuple we are accessing is in scope then all the fields will also be in scope

* Update tests so line numbers are correct
2023-07-10 08:34:10 +02:00
ringabout
6ec10a4c91 fixes #21730; adds pkgs2 as well when nimbleDir is set (#22234) 2023-07-07 12:40:29 +02:00
Andrey Makarov
2e987cb75a Tolerate markup errors for doc comments (#19607) (#22235)
Follow-up to #21576 (for solving #19607).

1) errors in Markdown mode for `.nim` doc comments are reported with
   red color but allow to generate `.html` with the comment represented by
   literate block (monospaced text). We suppose that it's what people want
   for (supposedly) small doc comments. And this behavior is also a bit
   more Markdown-ish in the sense that Markdown generally does not have
   the concept of parsing error.
   - However, for standalone `.md` it's **not** applied because for large
     files the consequences are way bigger.

(In {.doctype: rst.} mode the behavior is the same as before -- report
the error and stop.)
In future, when our parser can handle Markdown without errors according to
the spec, this code will most probably be not needed.
2023-07-07 12:38:37 +02:00
Andreas Rumpf
a15db5d60b fixes #22175 (#22229) 2023-07-06 15:15:50 +02:00
ringabout
dfa0d2569e alternative to #22219; adds a pointer wrapper for T destructor (#22225)
* alternative to #22219; adds a pointer wrapper for T destructor

* clean up and add comments

* Update compiler/ccgtypes.nim

* tidy up

* fixes comments

* fixes cpp

* fixes cpp
2023-07-06 11:14:42 +02:00
Jake Leahy
7616e6ee2b Fix concepts with doc comments (#22228)
* Add testcase

This tries to use a concept with a doc comment which currently leads to a segfault

* Ignore nil nodes which happen when there are doc comments in new style concept

This was done instead of semming the comments since `semConceptDecl` says it only supports lists of actual statements

* Go with alternative fix: Sem comments but ignore them

Since `nil` could mean anything it is best to not silently ignore it (In case another nil problem happens in future

Also fix test case so it isn't an infinite loop
2023-07-06 08:18:47 +02:00
ringabout
145e002c74 fixes #22132; hoisted openArray params result in erroneous code (#22224) 2023-07-05 11:21:57 +02:00
Andreas Rumpf
86ff37fab8 fixes #22138 (#22221) 2023-07-04 23:35:25 +02:00
ringabout
c513e37a70 fixes #22212; Compile error when running a Nimscript that compares se… (#22213)
fixes #22212; Compile error when running a Nimscript that compares seq with switch("mm", "arc")
2023-07-03 14:15:44 +02:00
ringabout
d9a24b9b81 fixes #22208; Ambiguous error when import modules with same names but… (#22211)
fixes #22208; Ambiguous error when import modules with same names but different aliases
2023-07-03 14:08:40 +02:00
ringabout
1ad618d96c clean up the documentation (#22196) 2023-07-02 22:36:05 +02:00
ringabout
57296a5139 fixes #22197; Distinct ref objects + destructor cause C++ codegen error (#22207) 2023-07-02 21:04:48 +02:00
Andreas Rumpf
83a5865024 fixes #22200 (#22206)
* fixes #22200

* typo
2023-07-02 20:57:10 +02:00
Juan M Gómez
2f109595e9 reset macrocache after each script evaluation (#22195) 2023-06-30 23:03:25 +02:00
metagn
210b10dd0d fix nested call regression in generic bodies (#22189)
fixes #22187
2023-06-29 22:05:18 +02:00
ringabout
41ec894cb0 alternative to #22183; nimscript shares the same compileTime sym with VM (#22184) 2023-06-29 11:21:22 +02:00
ringabout
d139d99946 fixes #19101; zero initialization union casts (#22185)
* zero initialization union casts

* cleans up and adds a test case for #19101

* uses nimZeroMem
2023-06-29 10:51:18 +02:00
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
Andreas Rumpf
427ad17161 fixes #22001 (#22177)
* fixes #22001

* added test case
2023-06-27 22:42:48 +02:00
Andreas Rumpf
ce0909f047 fixes #22137 (#22170) 2023-06-27 14:58:02 +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
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
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