summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
Commit message (Collapse)AuthorAgeFilesLines
* fixes
# To test stack overflow message

proc over(a: int): int =
  if a >= 10:
    assert false
    return
  result = over(a+1)+5

Echo($over(0))
33e20b7d71ee9ca137a3'>fix #12094 Use of _ (as var placeholder) inside a template causes XDe… ↵Bung2022-10-251-1/+2 | | | | | (#20635) fix #12094 Use of _ (as var placeholder) inside a template causes XDeclaredButNotUsed * borrowed procs can have a body now for documentation generation (#20617)ringabout2022-10-241-2/+3 | | | | | * borrowed procs can have a body now * fixes examples * remove implicit let/var default initialization (#20508)ringabout2022-10-071-11/+0 | * add default field support for object in ARC/ORC (#20480)ringabout2022-10-041-0/+11 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fresh start * add cpp target * add result support * add nimPreviewRangeDefault * reduce * use orc * refactor common parts * add tuple support * add testcase for tuple * cleanup; fixes nimsuggest tests * there is something wrong with cpp * remove * add support for seqs * fixes style * addd initial distinct support * remove links * typo * fixes tuple defaults * add rangedefault * add cpp support * fixes one more bugs * add more hasDefaults * fixes ordinal types * add testcase for #16744 * add testcase for #3608 * fixes docgen * small fix * recursive * fixes * cleanup and remove tuple support * fixes nimsuggest * fixes generics procs * refactor * increases timeout * refactor hasDefault * zero default; disable i386 * add tuples back * fixes bugs * fixes tuple * add more tests * fix one more bug regarding tuples * more tests and cleanup * remove messy distinct types which must be initialized by original types * add tests * fixes zero default * fixes grammar * fixes tests * fixes tests * fixes tests * fixes comments * fixes and add testcase * undo default values for results Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com> * pragma for sfCallsite instead of name check + better semantics, test (#20464)metagn2022-10-031-6/+1 | | | | | | | | | | | * pragma for sfCallsite instead of name check at every template definition Not documented because it seems to be for internal use? Should also make it possible to make comparisons and setops imports, but this doesn't have to be done. I can reuse a name like `cursor` for the pragma as well, added a new name just to be safe. * make sfCallsite recursive, add tests * Fix #19224 For loops over a hardcoded empty array crash the compiler (#20476)Bung2022-10-011-0/+3 | | | | | * Fix #11684 For loops over a hardcoded empty array crash the compiler * Update t19224.nim * closed ambiguous enum defaults to first overload (#20457)metagn2022-10-011-5/+9 | | | | | | | | | * closed ambiguous enum defaults to first overload * add warning * turn to hint * work around config * koch boot compiler with orc (#20467)ringabout2022-09-301-1/+1 | | | | | | | | | | | * koch boot compiler with orc * use orc * workaround bugs * move it * move the data * store full definition AST for consts, fix noRewrite (#20115)metagn2022-09-281-17/+28 | | | | | | | | | | | | | | | | | | | | | | | * 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 #20348; only respect the recursion limit if the symbol's generic type ↵Aditya Siram2022-09-221-0/+1 | | | | | has been generated by the compiler (#20377) Fixes #20348 * report expression has no type other than has to be used (or discarded… ↵Bung2022-09-201-0/+3 | | | | | (#20392) report expression has no type other than has to be used (or discarded) when typ is tyNone in discardCheck * remove deprecated type pragma syntax, fix bugs that required it (#20199)metagn2022-09-031-2/+17 | | | | | | | | | | | | | | | | | | | | | | | | * remove deprecated pragma syntax from 0.20.0 closes #4651, closes #16653 with a cheap fix for now due to how early `tfFinal` is set * remove type pragma between name and generics * undo removal, try removing bind expression (0.8.14) * fix test, unremove bind expr * remove again * Update changelog.md Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> * dependencies @ HEAD & weave test dependencies * try fix package ci Co-authored-by: konsumlamm <44230978+konsumlamm@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 * top-down type inference, implements rfc 149 (#20091)metagn2022-08-241-28/+48 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * micro implementation of rfc 149 refs https://github.com/nim-lang/RFCs/issues/149 * number/array/seq literals, more statements * try fix number literal alias issue * renew expectedType with if/case/try branch types * fix (nerf) index type handling and float typed int * use typeAllowed * tweaks + const test (tested locally) [skip ci] * fill out more of the checklist * more literals, change @ order, type conversions Not copying the full call tree before the typedesc call check in `semIndirectOp` is also a small performance improvement. * disable self-conversion warning * revert type conversions (maybe separate op later) * deal with CI for now (seems unrelated), try enums * workaround CI different way * proper fix * again * see sizes * lol * overload selection, simplify int literal -> float * range, new @ solution, try use fitNode for nil * use new magic * try fix ranges, new magic, deal with #20193 * add documentation, support templates Co-authored-by: Andreas Rumpf <rumpf_a@web.de> * fixes #20031; uint64 is an ordinal type since 1.0 (#20094)ringabout2022-07-271-1/+1 | | | | | * fixes #20031; uint64 is an ordinal type since 1.0 * Update compiler/semstmts.nim * .forbids pragma: defining forbidden tags (#20050)Lancer112112022-07-261-1/+1 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * .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> * Change `styleCheck` to ignore foreign packages (#19822)quantimnot2022-07-141-7/+7 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Change `styleCheck` to ignore foreign packages * Symbols from foreign packages are now ignored. * Fixed `styleCheck` violations in `compiler` package. * Added symbol ownership to custom annotation pragmas. * Minor refactors to cleanup style check callsites. * Minor internal documentation of reasons why a symbol isn't checked. Style violations were fixed in the compiler after thet were exposed by the changes. The compiler wouldn't compile otherwise. Symbol ownership for custom pragma annotations is needed for checking the annotation's style. A NPE was raised otherwise. Fixes #10201 See also nim-lang/RFCs#456 * Fix a misunderstanding about excluding field style checks I had refactored the callsites of `styleCheckUse` to apply the DRY principle, but I misunderstood the field access handling in a template as a general case. This corrects it. * Fix some `styleCheck` violations in `compiler/evalffi` The violations were exposed in CI when the compiler was built with libffi. * Removed some uneeded transitionary code * Add changelog entry Co-authored-by: quantimnot <quantimnot@users.noreply.github.com> * give a better error message for some template expansions (#19871)Andreas Rumpf2022-06-091-2/+4 | * [nimsuggest] return the type when on symbol in let/var (#19639)Ivan Yonchovski2022-04-071-3/+6 | | | - make sure `suggestSym` is called after `PSym.typ` is set. * nvro don't touch cdecl types [backport: 1.6] (#19461)flywind2022-01-281-0/+1 | | | * nvro don't touch cdecl types; fix #19342 again * New/better macro pragmas, mark some as experimental (#19406)metagn2022-01-201-116/+170 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * New/better macro pragmas, make some experimental fix #15920, close #18212, close #14781, close #6696, close https://github.com/nim-lang/RFCs/issues/220 Variable macro pragmas have been changed to only take a unary section node. They can now also be applied in sections with multiple variables, as well as `const` sections. They also accept arguments. Templates now support macro pragmas, mirroring other routine types. Type and variable macro pragmas have been made experimental. Symbols without parentheses instatiating nullary macros or templates has also been documented in the experimental manual. A check for a redefinition error based on the left hand side of variable definitions when using variable macro pragmas was disabled. This nerfs `byaddr` specifically, however this has been documented as a consequence of the experimental features `byaddr` uses. Given how simple these changes are I'm worried if I'm missing something. * accomodate compiler boot * allow weird pragmas * add test for #10994 * remove some control flow, try remove some logic * `caseStmtMacros` no longer experimental, experimental manual refactor (#19173)hlaaftana2021-11-231-4/+4 | | | | | | | | | | | * `caseStmtMacros` no longer experimental, experimental manual refactor * Update doc/manual.rst * apply review suggestions * apply review Co-authored-by: Andreas Rumpf <rumpf_a@web.de> * Accept nnkTypeSection from typedef macro pragmas (#19168)hlaaftana2021-11-221-5/+13 | * fixes 'lent T' inside object constructor [backport] (#18911)Andreas Rumpf2021-09-271-1/+1 | | | | | * fixes 'lent T' inside object constructor [backport] * progress * correct effect tracking for .borrowed procs [backport] (#18882)Andreas Rumpf2021-09-231-1/+4 | | | | | | | | | | | * correct effect tracking for .borrowed procs [backport] * progress * fix error message in a test * correctly fix it Co-authored-by: narimiran <narimiran@disroot.org> * fixes #18863 [backport] (#18871)Andreas Rumpf2021-09-201-1/+1 | * Dotborrow now works with generic distincts (#18848)Jason Beetham2021-09-141-1/+2 | * Generic pointer procs now error if no types supplied (#18832)Jason Beetham2021-09-111-1/+1 | | | | | | | * more precise logic for pointer procs * added test for generic pointer procs * Fixed generic getting bracket expr if erroring * implements https://github.com/nim-lang/RFCs/issues/407 (#18793)Andreas Rumpf2021-09-031-0/+14 | * strict effects (#18777)Andreas Rumpf2021-09-021-2/+7 | | | | | | | | | | | | | | | | | * fixes #17369 * megatest is green for --cpu:arm64 * docgen output includes more tags/raises * implemented 'effectsOf' * algorithm.nim: uses new effectsOf annotation * closes #18376 * closes #17475 * closes #13905 * allow effectsOf: [a, b] * added a test case * parameters that are not ours cannot be declared as .effectsOf * documentation * manual: added the 'sort' example * bootstrap with the new better options * fix: `var a{.foo.} = expr` inside templates (refs #15920) (except when `foo` ↵Timothee Cour2021-08-111-15/+20 | | | | | | | | | | | is overloaded) (#13869) * fix: `var a{.foo.} = expr` inside templates * add test * improve tdecls test * improve tests * add failing test * PRTEMP * fixup * implements overloadable enum values; WIP (#18470)Andreas Rumpf2021-07-281-1/+15 | | | | | * implements overloadable enum values * simpler code * fixes #18565 (#18593)Andreas Rumpf2021-07-271-11/+11 | | | * fixes #18565 * refactoring: removed dead code (#18567)Andreas Rumpf2021-07-241-1/+1 | * ORC: support for custom =trace procs (#18459)Andreas Rumpf2021-07-091-3/+10 | | | | | | | | | | | * ORC: support custom =trace procs (WIP) * Update tests/arc/tcustomtrace.nim Co-authored-by: Clyybber <darkmine956@gmail.com> * =trace is now documented and seems to work * make test green Co-authored-by: Clyybber <darkmine956@gmail.com> * ORC: use =destroy instead of =dispose (#18440)Andreas Rumpf2021-07-071-2/+0 | | | | | | * ORC refactoring in preparation for further changes (=dispose must die) * ORC: embrace =destroy, avoid =dispose * ORC: no need for =dispose * closes #18421 * improvements to hint:processing: show import stack, distinguish nims, show ↵Timothee Cour2021-06-301-0/+1 | | | | | | | | includes etc (#18372) * improvements to hint:processing * fix tests; do not show hintProcessing for nimscript unless given -d:nimHintProcessingNims * fix trunner and avoid need for -d:nimHintProcessingNims * fix some tests * Fix doubly typed forward declarations (#18279)Clyybber2021-06-161-1/+6 | | | | | | | | | * Add testcase * Fix testcase * Fix doubly typed forward decls * Better fix * fixes #18235 - proc annotation type macro sym leak (#18249)Saem Ghani2021-06-141-4/+4 | | | | | | | | | | | | | | | | | | | | | * fixes #18235 - proc annotation type macro sym leak - also fixed a typo - proc annotations guard symbol exports with shadow scopes - symbol handling is shadow scope aware * test for exporting an existing unexported sym this one is for my homie alaviss. * Special handling not needed in semProcAnnotation * Testcasing * [skip ci] clean-up and add some more comments * [skip ci] rm trailing whitespace Co-authored-by: Clyybber <darkmine956@gmail.com> * fixes #15884 (#18230)Andreas Rumpf2021-06-101-1/+1 | | | | | * fixes #15884 * micro optimization * fixes #18059 (#18140)Andreas Rumpf2021-06-021-1/+19 | | | | * fixes #18059 * Fixes #5034 illformed AST from getImpl with proc returning value (#17976)Dylan Modesitt2021-05-311-4/+21 | | | | | * Fixes 5034 * address comments * minor cleanups (#17948)Andreas Rumpf2021-05-061-2/+0 |