summary refs log tree commit diff stats
path: root/compiler/sempass2.nim
Commit message (Collapse)AuthorAgeFilesLines
* fixes addr/hiddenAddr in strictdefs (#23477)ringabout2024-04-101-2/+3
|
* + added nimsuggest support for exception inlay hints (#23202)Nikolay Nikolov2024-03-151-3/+60
| | | | | | | | | | | | | | | | | This adds nimsuggest support for displaying inlay hints for exceptions. An inlay hint is displayed around function calls, that can raise an exception, which isn't handled in the current subroutine (in other words, exceptions that can propagate back to the caller). On mouse hover on top of the hint, a list of exceptions that could propagate is shown. The changes, required to support this are already commited to nimlangserver and the VS code extension. The extension and the server allow configuration for whether these new exception hints are enabled (they can be enabled or disabled independently from the type hints), as well as the inlay strings that are inserted before and after the name of the function, around the function call. Potentially, one of these strings can be empty, for example, the user can choose to add an inlay hint only before the name of the function, or only after the name of the function.
* fixes a nimsuggest crash on init (#23300)Juan M Gómez2024-02-111-1/+1
|
* fixes strictnotnil for func, method, converter (#23083)ringabout2023-12-191-1/+1
|
* type refactor: part 4 (#23077)Andreas Rumpf2023-12-151-6/+6
|
* fixes yet another strictdefs bug (#23069)ringabout2023-12-151-0/+3
|
* type graph refactor; part 3 (#23064)Andreas Rumpf2023-12-141-1/+1
|
* type refactoring: part 2 (#23059)Andreas Rumpf2023-12-131-15/+9
|
* Types: Refactorings; step 1 (#23055)Andreas Rumpf2023-12-121-8/+8
|
* rework the vtable implementation embedding the vtable array directly with ↵ringabout2023-11-281-11/+53
| | | | | | | | | | | | | | | | | | | | | | | | new strictions on methods (#22991) **TODO** - [x] fixes changelog With the new option `nimPreviewVtables`, `methods` are confined in the same module where the type of the first parameter is defined - [x] make it opt in after CI checks its feasibility ## In the following-up PRs - [ ] in the following PRs, refactor code into a more efficient one - [ ] cpp needs special treatments since it cannot embed array in light of the preceding limits: ref https://github.com/nim-lang/Nim/pull/20977#discussion_r1035528927; we can support cpp backends with vtable implementations later on the comprise that uses indirect vtable access --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* prepare for the enforcement of `std` prefix (#22873)ringabout2023-10-291-3/+5
| | | follow up https://github.com/nim-lang/Nim/pull/22851
* NIR: progress (#22817)Andreas Rumpf2023-10-121-2/+2
| | | | | | Done: - [x] Implement conversions to openArray/varargs. - [x] Implement index/range checking.
* fixes `result` requires explicit initialization on noReturn code (#22717)ringabout2023-09-181-1/+1
| | | | | | fixes #21615; fixes #16735 It also partially fixes | #22673, though It still gives 'baseless' warnings.
* fixes branches interacting with break, raise etc. in strictdefs (#22627)ringabout2023-09-041-19/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ```nim {.experimental: "strictdefs".} type Test = object id: int proc test(): Test = if true: return Test() else: return echo test() ``` I will tackle https://github.com/nim-lang/Nim/issues/16735 and #21615 in the following PR. The old code just premises that in branches ended with returns, raise statements etc. , all variables including the result variable are initialized for that branch. It's true for noreturn statements. But it is false for the result variable in a branch tailing with a return statement, in which the result variable is not initialized. The solution is not perfect for usages below branch statements with the result variable uninitialized, but it should suffice for now, which gives a proper warning. It also fixes ```nim {.experimental: "strictdefs".} type Test = object id: int proc foo {.noreturn.} = discard proc test9(x: bool): Test = if x: foo() else: foo() ``` which gives a warning, but shouldn't
* follow up #22549 (#22551)ringabout2023-08-251-3/+4
|
* fixes a strictdef ten years long vintage bug, which counts the same thing ↵ringabout2023-08-241-10/+21
| | | | | twice (#22549) fixes a strictdef ten years long vintage bug
* unpublic the sons field of PType; the precursor to PType refactorings (#22446)ringabout2023-08-111-1/+1
| | | | | | | | | | | * unpublic the sons field of PType * tiny fixes * fixes an omittance * fixes IC * fixes
* modernize sempass2; `initEffects` now returns `TEffects` (#22435)ringabout2023-08-101-21/+13
|
* fixes cascades of out parameters, which produces wrong ProveInit warnings ↵ringabout2023-08-091-4/+10
| | | | (#22413)
* use strictdefs for compiler (#22365)ringabout2023-08-061-1/+3
| | | | | | | | | | | | | | | * wip; use strictdefs for compiler * checkpoint * complete the chores * more fixes * first phase cleanup * Update compiler/bitsets.nim * cleanup
* fixes #6499; disallow built-in procs used as procvars (#22291)ringabout2023-07-191-0/+1
|
* fixes #21987; don't create type bound ops for anything in a function with a ↵ringabout2023-06-041-1/+4
| | | | | | | `nodestroy` pragma (#21992) * fixes #21987; don't create type bound ops for anything in a function with a `nodestroy` pragma * add a comment
* Cpp Vfunctions draft (#21790)Juan M Gómez2023-05-171-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * introduces virtual pragma, modifies proc def, prevents proc decl * marks virtual procs as infix * forward declare vfuncs inside the typedef * adds naked callConv to virtual * virtual proc error if not defined in the same top level scope as the type * first param is now this. extracts genvirtualheaderproc * WIP syntax * supports obj. Removes the need for the prefix * parameter count starts as this. Cleanup * clean up * sem tests * adds integration tests * uses constraint to store the virtual content * introduces genVirtualProcParams --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* adds an experimental `mm:atomicArc` switch (#21798)ringabout2023-05-081-1/+1
|
* underscore as special word (#21766)metagn2023-05-021-1/+1
| | | | | * underscore as special word * fix really hard to notice error
* fixes #21245; warn about destructors that can raise (#21726)Andreas Rumpf2023-04-261-1/+2
| | | | | | | | | * fixes #21245; warn about destructors that can raise * doc update * progress * typo
* refactoring in preparation for better, simpler name mangling that wor… ↵Andreas Rumpf2023-04-241-2/+2
| | | | | | | | | | | (#21667) * refactoring in preparation for better, simpler name mangling that works with IC flawlessly * use new disamb field * see if this makes tests green * make tests green again
* remove useVersion (#21626)metagn2023-04-081-1/+1
| | | test removing useVersion
* fixes #21393 and misc style changes (#21419)Andreas Rumpf2023-02-241-9/+10
| | | | | | | | | * fixes #21393 and misc style changes * progress --------- Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* Implemented basic macro expand functionality (#20579)Ivan Yonchovski2023-01-271-0/+3
| | | | | | | | | | | | | | | | | | * Implemented level based macro expand functionality - it can handle single macro call or expand whole function/proc/etc and it - In addition, I have altered the parser to provide the endInfo for the node. The usefulness of the `endInfo` is not limited to the `expandMacro` functionality but also it is useful for `ideOutline` functionality and I have altered the ideOutline functionality to use `endInfo`. Note `endInfo` most of the time is lost during the AST transformation thus in `nimsuggest.nim` I am using freshly parsed tree to get the location information. * Make sure we stop expanding correctly * Test CI * Fix tv3_outline.nim
* fix #20253 (#21174)Bung2023-01-131-1/+4
| | | | | | | | | * fix #20253 * change NimbleStableCommit * Update koch.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #21043; fixes a named exception in the infixAs expression which ↵ringabout2022-12-121-0/+4
| | | | | | | | | | | generate an implicit uninitialized let statement (#21081) * fixes #21043; fixes a named exception in the infixAs expression which generate an implicit uninitialized let statement * Update compiler/sempass2.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* alternative, much simpler algorithm for strict func checking (#21066)Andreas Rumpf2022-12-111-19/+18
| | | | | | | | | | | | | * alternative, much simpler algorithm for strict func checking * forgot to git add new compiler module * new spec is incredibly simple to describe * fixes bigints regression * typos * closes #16305; closes #17387; closes #20863
* tiny refactoring related to sink parameter inference logic (#21064)Andreas Rumpf2022-12-101-1/+1
| | | | | * tiny refactoring related to sink parameter inference logic * Update compiler/sempass2.nim
* definite assignment analysis for let (#21024)ringabout2022-12-061-10/+22
| | | | | | | | | | | | | | | | | | | * draft for let daa * patch * fixes bugs * errors for global let variable reassignments * checkpoint * out param accepts let * add more tests * add documentation * merge tests
* issue a warning for ptr to cstring conversion[backport] (#20814)ringabout2022-11-111-0/+5
| | | | | * issue a warning for ptr to cstring conversion[backport] * add a changelog
* implemented strictCaseObjects (#20608)Andreas Rumpf2022-10-211-3/+3
| | | | | * implemented strictCaseObjects * changelog update
* fixes #20572 (#20585)Andreas Rumpf2022-10-171-1/+1
| | | | | * fixes #20572 * added a test case
* fixes #20515; base `method` requires explicit `{.gcsafe.}` to be GC-safe ↵ringabout2022-10-161-4/+12
| | | | | | | (#20574) * fixes #20515; base requires explicit `{.gcsafe.}` to be GC-safe * add tests
* fixes #19162; enable `strictEffects` for v2 (#19380)ringabout2022-10-151-4/+4
| | | | | | | | | | | | | | | | | | | * enable stricteffects * add gcsafe * fix tests * use func * fixes pegs tests * explicitly mark repr related procs with noSideEffect * add nimLegacyEffects * change URL * fixes docopt * add `raises: []` to repr * fixes weave * fixes nimyaml * fixes glob * fixes parsetoml * Apply suggestions from code review * Update testament/important_packages.nim * add legacy:laxEffects
* 'lock levels' are deprecated, now a noop (#20539)ringabout2022-10-111-77/+1
| | | | | * 'lock levels' are deprecated, now a noop * fixes tests
* DAA and 'out' parameters (#20506)Andreas Rumpf2022-10-061-16/+22
| | | | | | | | | | | * DAA and 'out' parameters * progress * documented strictDefs and out parameters * docs, tests and a bugfix * fixes silly regression
* cleanup nfFirstWrite flags (#20500)Andreas Rumpf2022-10-051-1/+1
|
* new move analyser2 (#20471)Andreas Rumpf2022-10-011-7/+45
| | | | | | | | * produce better code for closure environment creation * new 'first write' analysis; * scope based move analyser * code cleanup Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* store full definition AST for consts, fix noRewrite (#20115)metagn2022-09-281-4/+5
| | | | | | | | | | | | | | | | | | | | | | | * continue #9582 for consts, close #9331, fix #20114 also move extractPragma to ast to pave the way for things like {.strdefine: "abc".} etc * changelog correctly * fix jsgen * update tgetimpl * fix sighashes * fix #19766, add comment about postfix * fix noRewrite LOL refs #16620 * fix changelog * fix destructors
* fixes #19724; don't be aggressive when you infer sink parameters (#20314)Andreas Rumpf2022-09-121-7/+15
| | | | | | | | | | | | | | | | | | | | | | * fixes #19724; don't be aggressive when you infer sink parameters * better logic and updated tests * wip * fixes tests (#20330) * restore tests * try splitPath Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com> * Apply suggestions from code review * Apply suggestions from code review Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
* support cstring in `case` (#20130)metagn2022-09-011-1/+1
| | | | | | | | | | | | | | | * implement case for cstring for now just converts to string on C backend * custom implementation for cstring * remove leftover * revert even more * add nil + fix packages weird variant literal bug * update docs
* remove unused sfProcvar, "procvar" mentions (#20204)metagn2022-08-241-1/+2
| | | refs #12975. doesn't close it because wProcvar isn't removed
* .forbids pragma: defining forbidden tags (#20050)Lancer112112022-07-261-5/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * .forbids pragma: defining illegal effects for proc types This patch intends to define the opposite of the .tags pragma: a way to define effects which are not allowed in a proc. * updated documentation and changelogs for the forbids pragma * renamed notTagEffects to forbiddenEffects * corrected issues of forbids pragma the forbids pragma didn't handle simple restrictions properly and it also had issues with subtyping * removed incorrect character from changelog * added test to cover the interaction of methods and the forbids pragma * covering the interaction of the tags and forbids pragmas * updated manual about the forbids pragma * removed useless statement * corrected the subtyping of proc types using the forbids pragma * updated manual for the forbids pragma * updated documentations for forbids pragma * updated nim docs * updated docs with rsttester.nim * regenerated documentation * updated rst docs * Update changelog.md Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> * updated changelog * corrected typo Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* fix #19435; don't create TypeBoundOps for tyOpenArray, tyVarargs [backport: ↵flywind2022-04-251-1/+1
| | | | | | | | | 1.6] (#19723) * fix #19435; openArray wronyly registers typebounds * add testcase * don't create TypeBoundOps for tyOpenArray, tyVarargs