Commit Graph

6145 Commits

Author SHA1 Message Date
ringabout
52bf954ba5 checkpoint 2023-08-23 18:19:39 +08:00
metagn
a4781dc4bc use old typeinfo generation for hot code reloading (#22518)
* use old typeinfo generation for hot code reloading

* at least test hello world compilation on orc
2023-08-20 06:30:36 +02:00
Nan Xiao
6eb722c47d replace getOpt with getopt (#22515) 2023-08-19 15:05:17 +02:00
Tomohiro
eb83d20d0d Add staticFileExists and staticDirExists (#22278) 2023-08-18 16:47:47 +02:00
ringabout
7fababd583 make float32 literals stringifying behave in JS the same as in C (#22500) 2023-08-17 18:52:38 +02:00
metagn
98c39e8e57 cascade tyFromExpr in type conversions in generic bodies (#22499)
fixes #22490, fixes #22491, adapts #22029 to type conversions
2023-08-17 18:52:28 +02:00
ringabout
ee817557ec close #22748; cursorinference + -d:nimNoLentIterators results in err… (#22495)
closed #22748; cursorinference + -d:nimNoLentIterators results in erroneous recursion
2023-08-17 13:33:19 +02:00
Jason Beetham
6c4e7835bf When in object handles procedure call again, fixes #22474 (#22480)
Ping @narimiran please backport to the 2.0 line.
2023-08-15 17:48:31 +02:00
Andrey Makarov
a660c17d30 Markdown code blocks migration part 8 (#22478) 2023-08-15 06:27:36 +02:00
ringabout
09d0fda7fd fixes #22469; generates nimTestErrorFlag for top level statements (#22472)
fixes #22469; generates `nimTestErrorFlag` for top level statements
2023-08-14 13:08:01 +02:00
ringabout
4c89223171 relax the parameter of ensureMove; allow let statements (#22466)
* relax the parameter of `ensureMove`; allow let statements

* fixes the test
2023-08-12 13:23:54 +02:00
Bung
277393d0f1 close #17045;Compiler crash when a tuple iterator with when nimvm is … (#22452)
close #17045;Compiler crash when a tuple iterator with when nimvm is iterated in a closure iterator
2023-08-11 19:11:47 +08:00
Bung
3bb75f2dea close #18103 internal error: inconsistent environment type (#22451) 2023-08-11 18:50:31 +08:00
ringabout
faf1c91e6a fixes move sideeffects issues [backport] (#22439)
* fixes move sideeffects issues [backport]

* fix openarray

* fixes openarray
2023-08-10 18:04:29 +02:00
Juan M Gómez
8625e71250 adds support for functor in member (#22433)
* adds support for functor in member

* improves functor test
2023-08-10 14:15:23 +02:00
Bung
2aab03bdfb fix #19304 Borrowing std/times.format causes Error: illformed AST (#20659)
* fix #19304 Borrowing std/times.format causes Error: illformed AST

* follow suggestions

* mitigate for #4121

* improve error message
2023-08-10 16:26:23 +08:00
SirOlaf
baf350493b Fix #21760 (#22422)
* Remove call-specific replaceTypeVarsN

* Run for all call kinds and ignore typedesc

* Testcase

---------

Co-authored-by: SirOlaf <>
2023-08-10 07:56:09 +02:00
Juan M Gómez
6ec1c80779 makes asmnostackframe work with cpp member #22411 (#22429) 2023-08-09 20:57:52 +02:00
Bung
46e94c83d4 Fix #5780 (#22428)
* fix #5780
2023-08-09 23:17:08 +08:00
ringabout
5ec81d076b fixes cascades of out parameters, which produces wrong ProveInit warnings (#22413) 2023-08-09 13:49:30 +02:00
Bung
d53a89e453 fix #12938 index type of array in type section without static (#20529)
* fix #12938 nim compiler assertion fail when literal integer is passed as template argument for array size

* use new flag tfImplicitStatic

* fix

* fix #14193

* correct tfUnresolved add condition

* clean test
2023-08-09 12:45:43 +02:00
ringabout
5334dc921f fixes #22419; async/closure environment does not align local variables (#22425)
* fixes #22419; async/closure environment does not align local variables

* Apply suggestions from code review

* Update tests/align/talign.nim

Co-authored-by: Jacek Sieka <arnetheduck@gmail.com>

* apply code review

* update tests

---------

Co-authored-by: Jacek Sieka <arnetheduck@gmail.com>
2023-08-09 12:43:17 +02:00
Bung
989da75b84 fix #20891 Illegal capture error of env its self (#22414)
* fix #20891 Illegal capture error of env its self

* fix innerClosure too earlier, make condition shorter
2023-08-09 09:43:39 +02:00
metagn
3aaef9e4cf block ambiguous type conversion dotcalls in generics (#22375)
fixes #22373
2023-08-09 06:12:14 +02:00
Bung
37d8f32ae9 fix #18823 Passing Natural to bitops.BitsRange[T] parameter in generi… (#20683)
* fix #18823 Passing Natural to bitops.BitsRange[T] parameter in generic proc is compile error
2023-08-08 16:06:47 +08:00
Juan M Gómez
b5b4b48c94 [C++] Member pragma RFC (https://github.com/nim-lang/RFCs/issues/530) (#22272)
* [C++] Member pragma RFC #530
rebase devel

* changes the test so `echo` is not used before Nim is init

* rebase devel

* fixes Error: use explicit initialization of X for clarity [Uninit]
2023-08-07 10:11:00 +02:00
konsumlamm
53586d1f32 Fix some jsgen bugs (#22330)
Fix `succ`, `pred`
Fix `genRangeChck` for unsigned ints
Fix typo in `dec`
2023-08-06 14:24:35 +02:00
SirOlaf
67122a9cb6 Let inferGenericTypes continue if a param is already bound (#22384)
* Play with typeRel

* Temp solution: Fixup call's param types

* Test result type with two generic params

* Asserts

* Tiny cleanup

* Skip sink

* Ignore proc

* Use changeType

* Remove conversion

* Remove last bits of conversion

* Flag

---------

Co-authored-by: SirOlaf <>
2023-08-06 14:23:00 +02:00
Bung
95c751a9e4 fix #15005; [ARC] Global variable declared in a block is destroyed too… (#22388)
* fix #15005 [ARC] Global variable declared in a block is destroyed too early
2023-08-06 15:46:43 +08:00
Bung
137d608d7d add test for #3907 (#21069)
* add test for #3907
2023-08-06 15:21:24 +08:00
konsumlamm
e15e19308e Revert adding generic V: Ordinal parameter to succ, pred, inc, dec (#22328)
* Use `int` in `digitsutils`, `dragonbox`, `schubfach`

* Fix error message
2023-08-06 00:38:46 +08:00
Tomohiro
db435a4a79 Fix searchExtPos so that it returns -1 when the path is not a file ext (#22245)
* Fix searchExtPos so that it returns -1 when the path is not a file ext

* fix comparision expression

* Remove splitDrive from searchExtPos
2023-08-04 20:00:43 +02:00
Bung
26f183043f fix #20883 Unspecified generic on default value segfaults the compiler (#21172)
* fix #20883 Unspecified generic on default value segfaults the compiler

* fallback to isGeneric

* change to closer error

* Update t20883.nim
2023-08-04 13:35:43 +02:00
Jake Leahy
3efabd3ec6 Fix crash when using uninstantiated generic (#22379)
* Add test case

* Add in a bounds check when accessing generic types

Removes idnex out of bounds exception when comparing a generic that isn't fully instantiated
2023-08-04 12:21:36 +02:00
konsumlamm
d37b620757 Make repr(HSlice) always available (#22332)
Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
2023-08-04 05:29:48 +02:00
SirOlaf
8d8d75706c Add experimental inferGenericTypes switch (#22317)
* Infer generic bindings

* Simple test

* Add t

* Allow it to work for templates too

* Fix some builds by putting bindings in a template

* Fix builtins

* Slightly more exotic seq test

* Test value-based generics using array

* Pass expectedType into buildBindings

* Put buildBindings into a proc

* Manual entry

* Remove leftover `

* Improve language used in the manual

* Experimental flag and fix basic constructors

* Tiny commend cleanup

* Move to experimental manual

* Use 'kind' so tuples continue to fail like before

* Explicitly disallow tuples

* Table test and document tuples

* Test type reduction

* Disable inferGenericTypes check for CI tests

* Remove tuple info in manual

* Always reduce types. Testing CI

* Fixes

* Ignore tyGenericInst

* Prevent binding already bound generic params

* tyUncheckedArray

* Few more types

* Update manual and check for flag again

* Update tests/generics/treturn_inference.nim

* var candidate, remove flag check again for CI

* Enable check once more

---------

Co-authored-by: SirOlaf <>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-08-03 22:49:52 +02:00
Bung
6b913b4741 Revert "fix #22173 sink paramers not moved into closure (refc) (#22… (#22376)
Revert "fix #22173 `sink` paramers not moved into closure (refc) (#22359)"

This reverts commit b40da812f7.
2023-08-03 19:56:05 +02:00
Bung
b40da812f7 fix #22173 sink paramers not moved into closure (refc) (#22359)
* use genRefAssign when assign to sink string

* add test case
2023-08-02 14:08:51 +02:00
ringabout
825a0e7df4 fixes #22362; Compiler crashes with staticBoundsCheck on (#22363) 2023-08-02 11:00:34 +02:00
ringabout
f3a7622514 fixes #22360; compare with the half of randMax (#22361)
* fixes #22360; compare with the half of randMax

* add a test
2023-08-02 10:58:29 +02:00
ringabout
a23e53b490 fixes #22262; fixes -d:useMalloc broken with --mm:none and --threads on (#22355)
* fixes #22262; -d:useMalloc broken with --mm:none and threads on

* fixes
2023-08-01 15:18:08 +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
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
SirOlaf
808c9c6c2a Testcase for #22008 (#22320)
Testcase

Co-authored-by: SirOlaf <>
2023-07-23 21:35:30 +08:00
konsumlamm
0e555ade31 Add test for #22309 (#22316) 2023-07-22 21:11:08 +02:00
konsumlamm
576f4a7348 Fix doc comment rendering for concepts (#22312) 2023-07-22 19:10:12 +02:00