Commits on Apr 16, 2024

  1. bump NimVersion to 2.0.5

    narimiran committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    3ad1602 View commit details
    Browse the repository at this point in the history

Commits on Apr 17, 2024

  1. fixes #22360; compare with the half of randMax (#22361)

    * fixes #22360; compare with the half of randMax
    
    * add a test
    
    (cherry picked from commit f3a7622)
    ringabout authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    4133958 View commit details
    Browse the repository at this point in the history
  2. fixes #22362; Compiler crashes with staticBoundsCheck on (#22363)

    (cherry picked from commit 825a0e7)
    ringabout authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    1c19d5c View commit details
    Browse the repository at this point in the history
  3. Make repr(HSlice) always available (#22332)

    Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
    (cherry picked from commit d37b620)
    2 people authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    526dbf0 View commit details
    Browse the repository at this point in the history
  4. follow up #22322; fixes changelog (#22381)

    (cherry picked from commit fb7acd6)
    ringabout authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    7fbf429 View commit details
    Browse the repository at this point in the history
  5. fixes a typo in the manual (#22383)

    ref 0d3bde9#commitcomment-122093273
    
    (cherry picked from commit 7c2a2c8)
    ringabout authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    d097028 View commit details
    Browse the repository at this point in the history
  6. 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 26f1830)
    bung87 authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    f4d99c8 View commit details
    Browse the repository at this point in the history
  7. 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 db435a4)
    demotomohiro authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    ac66f6c View commit details
    Browse the repository at this point in the history
  8. destructors: better docs [backport:2.0] (#22391)

    (cherry picked from commit 9872453)
    Araq authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    fb2cc06 View commit details
    Browse the repository at this point in the history
  9. Prevent early destruction of gFuns, fixes AddressSanitizer: heap-use-…

    …after-free (#22386)
    
    Prevent destruction of gFuns before callClosures
    
    (cherry picked from commit e039690)
    norrath-hero-cn authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    36b339b View commit details
    Browse the repository at this point in the history
  10. add test for #3907 (#21069)

    * add test for #3907
    
    (cherry picked from commit 137d608)
    bung87 authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    42e4190 View commit details
    Browse the repository at this point in the history
  11. Delete parse directory, which was pushed wrongly before [backport] (#…

    …22401)
    
    Delete parse directory
    
    (cherry picked from commit 614a18c)
    ringabout authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    a739444 View commit details
    Browse the repository at this point in the history
  12. 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 37d8f32)
    bung87 authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    c1745b5 View commit details
    Browse the repository at this point in the history
  13. 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 10a6e4c)
    ringabout authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    09109c5 View commit details
    Browse the repository at this point in the history
  14. 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 989da75)
    bung87 authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    b67d0a6 View commit details
    Browse the repository at this point in the history
  15. 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 d53a89e)
    bung87 authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    bd63124 View commit details
    Browse the repository at this point in the history
  16. Fix #21760 (#22422)

    * Remove call-specific replaceTypeVarsN
    
    * Run for all call kinds and ignore typedesc
    
    * Testcase
    
    ---------
    
    Co-authored-by: SirOlaf <>
    (cherry picked from commit baf3504)
    SirOlaf authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    2fa314a View commit details
    Browse the repository at this point in the history
  17. fix #19304 Borrowing std/times.format causes Error: illformed AST (#2…

    …0659)
    
    * fix #19304 Borrowing std/times.format causes Error: illformed AST
    
    * follow suggestions
    
    * mitigate for #4121
    
    * improve error message
    
    (cherry picked from commit 2aab03b)
    bung87 authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    6654803 View commit details
    Browse the repository at this point in the history
  18. fixes move sideeffects issues [backport] (#22439)

    * fixes move sideeffects issues [backport]
    
    * fix openarray
    
    * fixes openarray
    
    (cherry picked from commit faf1c91)
    ringabout authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    6f00b46 View commit details
    Browse the repository at this point in the history
  19. fix #22448 Remove structuredErrorHook temporary in tryConstExpr (#…

    …22450)
    
    * fix #22448
    
    * add test
    
    (cherry picked from commit 48da472)
    Pylgos authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    814e929 View commit details
    Browse the repository at this point in the history
  20. fixes #22469; generates nimTestErrorFlag for top level statements (#2…

    …2472)
    
    fixes #22469; generates `nimTestErrorFlag` for top level statements
    
    (cherry picked from commit 09d0fda)
    ringabout authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    2a4755d View commit details
    Browse the repository at this point in the history
  21. cascade tyFromExpr in type conversions in generic bodies (#22499)

    fixes #22490, fixes #22491, adapts #22029 to type conversions
    
    (cherry picked from commit 98c39e8)
    metagn authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    8eaf98d View commit details
    Browse the repository at this point in the history
  22. 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 c0ecdb0)
    2 people authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    06464fe View commit details
    Browse the repository at this point in the history
  23. allow non-pragma special words as user pragmas (#22526)

    allow non-pragma special words as macro pragmas
    
    fixes #22525
    
    (cherry picked from commit 602f537)
    metagn authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    c39a013 View commit details
    Browse the repository at this point in the history
  24. 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 53d43e9)
    2 people authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    0d02bee View commit details
    Browse the repository at this point in the history
  25. Fix getAppFilename exception handling (#22544)

    * Fix `getAppFilename` exception handling
    
    avoid platform-dependendent error handling strategies
    
    * more fixes
    
    * space
    
    (cherry picked from commit bc9785c)
    arnetheduck authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    271632a View commit details
    Browse the repository at this point in the history
  26. fixes a strictdef ten years long vintage bug, which counts the same t…

    …hing twice (#22549)
    
    fixes a strictdef ten years long vintage bug
    
    (cherry picked from commit 1013378)
    ringabout authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    26f3dff View commit details
    Browse the repository at this point in the history
  27. 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 0b78b7f)
    bung87 authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    d49d7ba View commit details
    Browse the repository at this point in the history
  28. properly fold constants for dynlib pragma (#22575)

    fixes #12929
    
    (cherry picked from commit 6b955ac)
    metagn authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    7c44af4 View commit details
    Browse the repository at this point in the history
  29. type annotations for variable tuple unpacking, better error messages (#…

    …22611)
    
    * type annotations for variable tuple unpacking, better error messages
    
    closes #17989, closes nim-lang/RFCs#339
    
    * update grammar
    
    * fix test
    
    (cherry picked from commit ba158d7)
    metagn authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    3911c90 View commit details
    Browse the repository at this point in the history
  30. 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 affd3f7)
    ringabout authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    24f3272 View commit details
    Browse the repository at this point in the history
  31. don't update const symbol on const section re-sems (#22609)

    fixes #19849
    
    (cherry picked from commit 53d9fb2)
    metagn authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    7335495 View commit details
    Browse the repository at this point in the history
  32. resolve local symbols in generic type call RHS (#22610)

    resolve local symbols in generic type call
    
    fixes #14509
    
    (cherry picked from commit f1789cc)
    metagn authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    131a032 View commit details
    Browse the repository at this point in the history
  33. 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 0c6e138)
    jmgomez authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    d4c1cc7 View commit details
    Browse the repository at this point in the history
  34. Fix the problem where instances of generic objects with sendable pr…

    …agmas are not being cached (#22622)
    
    remove `tfSendable` from `eqTypeFlags`
    
    (cherry picked from commit 9f1fe8a)
    Pylgos authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    45aa0a4 View commit details
    Browse the repository at this point in the history
  35. fix isNil folding for compile time closures (#22574)

    fixes #20543
    
    (cherry picked from commit bd6adbc)
    metagn authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    70d771d View commit details
    Browse the repository at this point in the history
  36. 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 480e98c)
    metagn authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    70ab7a5 View commit details
    Browse the repository at this point in the history
  37. make getType nodes of generic insts have full inst type (#22655)

    fixes #22639 for the third time
    
    Nodes generated by `getType` for `tyGenericInst` types, instead of
    having the original `tyGenericInst` type, will have the type of the last
    child (due to the `mapTypeToAst` calls which set the type to the given
    argument). This will cause subsequent `getType` calls to lose
    information and think it's OK to use the sym of the instantiated type
    rather than fully expand the generic instantiation.
    
    To prevent this, update the type of the node from the `mapTypeToAst`
    calls to the full generic instantiation type.
    
    (cherry picked from commit ed9e3cb)
    metagn authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    9ac5666 View commit details
    Browse the repository at this point in the history
  38. Fix #21742: Check generic alias depth before skip (#22443)

    Close #21742
    
    Checking if there's any side-effects and if just changing typeRel is
    adequate for this issue before trying to look into related ones.
    
    `skipBoth` is also not that great, it can lead to code that works
    sometimes but fails when the proc is instantiated with branching
    aliases. This is mostly an issue with error clarity though.
    
    ---------
    
    Co-authored-by: SirOlaf <unknown>
    Co-authored-by: SirOlaf <>
    (cherry picked from commit 2a8c759)
    SirOlaf authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    28cef86 View commit details
    Browse the repository at this point in the history
  39. fixes #22662 Procs with constructor pragma doesn't initialize object'…

    …s fields (#22665)
    
    fixes #22662 Procs with constructor pragma doesn't initialize object's
    fields
    
    ---------
    
    Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
    (cherry picked from commit d45270b)
    2 people authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    1bbbb2f View commit details
    Browse the repository at this point in the history
  40. fixes #22664; guard against potential seqs self assignments (#22671)

    fixes #22664
    
    (cherry picked from commit 5f13e15)
    ringabout authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    a12cb27 View commit details
    Browse the repository at this point in the history
  41. Make newSeqOfCap not initialize memory. (#21842)

    It's used in `newSeqUninitialized`.
    
    ---------
    
    Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
    (cherry picked from commit 8853fb0)
    2 people authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    12f2c36 View commit details
    Browse the repository at this point in the history
  42. [minor] merge similar branches in vmgen (#22683)

    (cherry picked from commit 2ce9197)
    ringabout authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    cb3e5d3 View commit details
    Browse the repository at this point in the history
  43. 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>
    (cherry picked from commit fbb5ac5)
    2 people authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    3ddacd9 View commit details
    Browse the repository at this point in the history
  44. fixes the discVal register is used after free in vmgen (#22688)

    follow up #11955
    
    (cherry picked from commit b1a8d69)
    ringabout authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    7083d39 View commit details
    Browse the repository at this point in the history
  45. 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.
    
    (cherry picked from commit ac1804a)
    metagn authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    b2cb5f5 View commit details
    Browse the repository at this point in the history
  46. followup of #22568 (#22690)

    (cherry picked from commit 38b5823)
    AmjadHD authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    bbf3211 View commit details
    Browse the repository at this point in the history
  47. implement semgnrc for tuple and object type nodes (#22709)

    fixes #22699
    
    (cherry picked from commit 8836207)
    metagn authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    dc6058f View commit details
    Browse the repository at this point in the history
  48. Fix #22713: Make size unknown for tyForward (#22714)

    Close #22713
    
    ---------
    
    Co-authored-by: SirOlaf <>
    (cherry picked from commit fcf4c1a)
    SirOlaf authored and narimiran committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    344feb0 View commit details
    Browse the repository at this point in the history

Commits on Apr 18, 2024

  1. fixes incorrect cint overflow in system (#22718)

    fixes #22700
    
    (cherry picked from commit 63c2ea5)
    ringabout authored and narimiran committed Apr 18, 2024
    Configuration menu
    Copy the full SHA
    adf3e3c View commit details
    Browse the repository at this point in the history