metagn
70ab7a53f3
resolve unambiguous enum symchoices from local scope, error on rest ( #22606 )
...
fixes #22598 , properly fixes #21887 and fixes test case issue number
When an enum field sym choice has to choose a type, check if its name is
ambiguous in the local scope, then check if the first symbol found in
the local scope is the first symbol in the sym choice. If so, choose
that symbol. Otherwise, give an ambiguous identifier error.
The dependence on the local scope implies this will always give
ambiguity errors for unpicked enum symchoices from generics and
templates and macros from other scopes. We can change `not
isAmbiguous(...) and foundSym == first` to `not (isAmbiguous(...) and
foundSym == first)` to make it so they never give ambiguity errors, and
always pick the first symbol in the symchoice. I can do this if this is
preferred, but no code from CI seems affected.
(cherry picked from commit 480e98c479 )
2024-04-17 14:06:38 +02:00
metagn
70d771d1a9
fix isNil folding for compile time closures ( #22574 )
...
fixes #20543
(cherry picked from commit bd6adbcc9d )
2024-04-17 14:06:21 +02:00
Pylgos
45aa0a4725
Fix the problem where instances of generic objects with sendable pragmas are not being cached ( #22622 )
...
remove `tfSendable` from `eqTypeFlags`
(cherry picked from commit 9f1fe8a2da )
2024-04-17 14:06:09 +02:00
Juan M Gómez
d4c1cc7a34
fixes internal error: no generic body fixes #1500 ( #22580 )
...
* fixes internal error: no generic body fixes #1500
* adds guard
* adds guard
* removes unnecessary test
* refactor: extracts containsGenericInvocationWithForward
(cherry picked from commit 0c6e13806d )
2024-04-17 14:06:00 +02:00
metagn
131a0328b5
resolve local symbols in generic type call RHS ( #22610 )
...
resolve local symbols in generic type call
fixes #14509
(cherry picked from commit f1789cc465 )
2024-04-17 14:05:52 +02:00
metagn
7335495db7
don't update const symbol on const section re-sems ( #22609 )
...
fixes #19849
(cherry picked from commit 53d9fb259f )
2024-04-17 14:05:42 +02:00
ringabout
24f3272db3
fixes #22613 ; Default value does not work with object's discriminator ( #22614 )
...
* fixes #22613 ; Default value does not work with object's discriminator
fixes #22613
* merge branches
* add a test case
* fixes status
* remove outdated comments
* move collectBranchFields into the global scope
(cherry picked from commit affd3f7858 )
2024-04-17 14:04:48 +02:00
metagn
3911c90d7b
type annotations for variable tuple unpacking, better error messages ( #22611 )
...
* type annotations for variable tuple unpacking, better error messages
closes #17989 , closes https://github.com/nim-lang/RFCs/issues/339
* update grammar
* fix test
(cherry picked from commit ba158d73dc )
2024-04-17 14:04:43 +02:00
metagn
7c44af4e22
properly fold constants for dynlib pragma ( #22575 )
...
fixes #12929
(cherry picked from commit 6b955ac4af )
2024-04-17 14:04:29 +02:00
Bung
d49d7ba90c
fix #22548;environment misses for type reference in iterator access n… ( #22559 )
...
* fix #22548;environment misses for type reference in iterator access nested in closure
* fix #21737
* Update lambdalifting.nim
* remove containsCallKinds
* simplify
(cherry picked from commit 0b78b7f595 )
2024-04-17 14:04:19 +02:00
ringabout
26f3dfff75
fixes a strictdef ten years long vintage bug, which counts the same thing twice ( #22549 )
...
fixes a strictdef ten years long vintage bug
(cherry picked from commit 1013378854 )
2024-04-17 14:03:45 +02:00
Jacek Sieka
271632a72d
Fix getAppFilename exception handling ( #22544 )
...
* Fix `getAppFilename` exception handling
avoid platform-dependendent error handling strategies
* more fixes
* space
(cherry picked from commit bc9785c08d )
2024-04-17 14:01:27 +02:00
metagn
0d02bee23f
round out tuple unpacking assignment, support underscores ( #22537 )
...
* round out tuple unpacking assignment, support underscores
fixes #18710
* fix test messages
* use discard instead of continue
Co-authored-by: Andreas Rumpf <rumpf_a@web.de >
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de >
(cherry picked from commit 53d43e9671 )
2024-04-17 14:00:45 +02:00
metagn
c39a0139fc
allow non-pragma special words as user pragmas ( #22526 )
...
allow non-pragma special words as macro pragmas
fixes #22525
(cherry picked from commit 602f537eb2 )
2024-04-17 12:40:00 +02:00
SirOlaf
06464fe2ff
Fix #21722 ( #22512 )
...
* Keep return in mind for sink
* Keep track of return using bool instead of mode
* Update compiler/injectdestructors.nim
* Add back IsReturn
---------
Co-authored-by: SirOlaf <>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de >
(cherry picked from commit c0ecdb01a9 )
2024-04-17 12:40:00 +02:00
metagn
8eaf98d64f
cascade tyFromExpr in type conversions in generic bodies ( #22499 )
...
fixes #22490 , fixes #22491 , adapts #22029 to type conversions
(cherry picked from commit 98c39e8e57 )
2024-04-17 12:40:00 +02:00
ringabout
2a4755ddf2
fixes #22469 ; generates nimTestErrorFlag for top level statements ( #22472 )
...
fixes #22469 ; generates `nimTestErrorFlag` for top level statements
(cherry picked from commit 09d0fda7fd )
2024-04-17 12:39:59 +02:00
Pylgos
814e929eeb
fix #22448 Remove structuredErrorHook temporary in tryConstExpr ( #22450 )
...
* fix #22448
* add test
(cherry picked from commit 48da472dd2 )
2024-04-17 12:39:59 +02:00
ringabout
6f00b46c4b
fixes move sideeffects issues [backport] ( #22439 )
...
* fixes move sideeffects issues [backport]
* fix openarray
* fixes openarray
(cherry picked from commit faf1c91e6a )
2024-04-17 12:39:44 +02:00
Bung
665480372e
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
(cherry picked from commit 2aab03bdfb )
2024-04-17 10:57:32 +02:00
SirOlaf
2fa314a89d
Fix #21760 ( #22422 )
...
* Remove call-specific replaceTypeVarsN
* Run for all call kinds and ignore typedesc
* Testcase
---------
Co-authored-by: SirOlaf <>
(cherry picked from commit baf350493b )
2024-04-17 10:55:19 +02:00
Bung
bd63124a00
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
(cherry picked from commit d53a89e453 )
2024-04-17 10:55:14 +02:00
Bung
b67d0a64b4
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
(cherry picked from commit 989da75b84 )
2024-04-17 10:55:05 +02:00
ringabout
09109c55c9
clean up gc:arc or gc:orc in docs and in error messages ( #22408 )
...
* clean up gc:arc/orc in docs
* in error messages
(cherry picked from commit 10a6e4c236 )
2024-04-17 10:54:56 +02:00
Bung
c1745b5924
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
(cherry picked from commit 37d8f32ae9 )
2024-04-17 09:37:18 +02:00
ringabout
a7394440b9
Delete parse directory, which was pushed wrongly before [backport] ( #22401 )
...
Delete parse directory
(cherry picked from commit 614a18cd05 )
2024-04-17 09:37:02 +02:00
Bung
42e4190e1a
add test for #3907 ( #21069 )
...
* add test for #3907
(cherry picked from commit 137d608d7d )
2024-04-17 09:36:48 +02:00
norrath-hero-cn
36b339bbcf
Prevent early destruction of gFuns, fixes AddressSanitizer: heap-use-after-free ( #22386 )
...
Prevent destruction of gFuns before callClosures
(cherry picked from commit e0396900ed )
2024-04-17 09:36:41 +02:00
Andreas Rumpf
fb2cc06557
destructors: better docs [backport:2.0] ( #22391 )
...
(cherry picked from commit 9872453365 )
2024-04-17 09:36:34 +02:00
Tomohiro
ac66f6ce7a
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
(cherry picked from commit db435a4a79 )
2024-04-17 09:36:23 +02:00
Bung
f4d99c8d56
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
(cherry picked from commit 26f183043f )
2024-04-17 09:36:10 +02:00
ringabout
d097028307
fixes a typo in the manual ( #22383 )
...
ref 0d3bde95f5 (commitcomment-122093273)
(cherry picked from commit 7c2a2c8dc8 )
2024-04-17 09:35:58 +02:00
ringabout
7fbf42960b
follow up #22322 ; fixes changelog ( #22381 )
...
(cherry picked from commit fb7acd6600 )
2024-04-17 09:35:13 +02:00
konsumlamm
526dbf0cf2
Make repr(HSlice) always available ( #22332 )
...
Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com >
(cherry picked from commit d37b620757 )
2024-04-17 09:34:31 +02:00
ringabout
1c19d5c72e
fixes #22362 ; Compiler crashes with staticBoundsCheck on ( #22363 )
...
(cherry picked from commit 825a0e7df4 )
2024-04-17 09:34:23 +02:00
ringabout
413395866f
fixes #22360 ; compare with the half of randMax ( #22361 )
...
* fixes #22360 ; compare with the half of randMax
* add a test
(cherry picked from commit f3a7622514 )
2024-04-17 09:34:15 +02:00
narimiran
3ad16028aa
bump NimVersion to 2.0.5
2024-04-16 15:49:33 +02:00
Nikolay Nikolov
b47747d318
[backport v2.0] Converted the 'invalid kind for firstOrd/lastOrd(XXX)' messages from internal errors to fatal errors. ( #23443 ) ( #23446 )
...
This fixes a nimsuggest crash when opening:
beacon_chain/consensus_object_pools/blockchain_dag.nim
from the nimbus-eth2 project and many other .nim files (44 files, to be
precise) in the same project.
Replaces: https://github.com/nim-lang/Nim/pull/23402 (cherry picked from
commit c934d5986d )
v2.0.4
2024-03-27 15:58:56 +01:00
Александр Старочкин
5667fbfbf3
fix position for "imported but not used" warning for modules inside brackets ( #23424 )
2024-03-21 08:03:31 +01:00
narimiran
d4b58b0b06
bump NimVersion to 2.0.4
2024-03-19 16:39:02 +01:00
Nikolay Nikolov
ef356cfd4b
* [backport] fixed nimsuggest crash with 'Something = concept' put (erroneously) outside of a 'type' block ( #23331 ) ( #23346 )
...
(cherry picked from commit 37ed8c8480 )
2024-03-19 05:46:52 +01:00
Juan M Gómez
e374759f29
[Backport 2.0] When NimScript errors prevents NimSuggest from Init ( #23349 )
2024-03-09 11:42:34 +01:00
Juan M Gómez
0de70dc7f3
[backport 2.0] nimsuggest fix ( #23336 )
2024-03-04 09:58:54 +01:00
Andreas Rumpf
2f15b67fd9
fixes an issue with string to 'var openArray' at compile-time; [backport] ( #23363 )
...
(cherry picked from commit 24fbacc63f )
2024-03-03 15:42:20 +01:00
ringabout
e03667e920
improve error messages [backport] ( #23345 )
...
ref https://forum.nim-lang.org/t/11052

(cherry picked from commit 1e7ca2dc78 )
2024-02-27 08:17:37 +01:00
Nikolay Nikolov
11c048b06f
fixes #22753 ; Nimsuggest segfault with invalid assignment to table ( #22781 ) ( #23313 )
...
fixes #22753
## Future work
We should turn all the error nodes into nodes of a nkError kind, which
could be a industrious task. But perhaps we can add a special treatment
for error nodes to make the transition smooth.
(cherry picked from commit 642ac0c1c3 )
Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com >
2024-02-24 07:54:42 +01:00
Nikolay Nikolov
22de3ae53e
* fixed nimsuggest crash when opening a .nim file, that contain a {.fatal: "msg".} pragma. ( #23325 ) ( #23328 )
...
(cherry picked from commit 773c066634 )
2024-02-24 07:40:18 +01:00
Juan M Gómez
3be2514683
[Backport 2.0] Itanium mangling scheme ( #23301 )
2024-02-13 08:09:23 +01:00
ringabout
57658b685c
fixes regression #23280 ; Operations on inline toOpenArray len return a wrong result ( #23285 )
...
fixes #23280
(cherry picked from commit 4b67cccf50 )
2024-02-07 20:25:45 +01:00
ringabout
5f6ff1f051
compute checksum of nim files early in the pipelines ( #23268 )
...
related https://github.com/nim-lang/Nim/issues/21717 configs will be
resolved later
(cherry picked from commit 519d976f62 )
2024-02-01 12:30:21 +01:00