summary refs log tree commit diff stats
path: root/compiler/ast.nim
Commit message (Collapse)AuthorAgeFilesLines
* fixes #20572 (#20585)Andreas Rumpf2022-10-171-2/+1
| | | | | * fixes #20572 * added a test case
* 'lock levels' are deprecated, now a noop (#20539)ringabout2022-10-111-12/+0
| | | | | * 'lock levels' are deprecated, now a noop * fixes tests
* DAA and 'out' parameters (#20506)Andreas Rumpf2022-10-061-3/+6
| | | | | | | | | | | * 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-2/+1
|
* add default field support for object in ARC/ORC (#20480)ringabout2022-10-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-0/+6
| | | | | | | | | | | * 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
* new move analyser2 (#20471)Andreas Rumpf2022-10-011-2/+4
| | | | | | | | * 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-1/+20
| | | | | | | | | | | | | | | | | | | | | | | * 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
* no ropes WIP (#20433)Andreas Rumpf2022-09-271-2/+2
| | | | | | | | | | | | | * refactorings in preparation for ropes elimination of the C code generator; mostly the usual ': Rope' -> 'result: var Rope' rewrite * rewrote ccgcalls.nim * refactored ccgexprs.nim * ccgliterals: refactoring * refactoring: code dealing with name mangling * refactoring: getRecordFieldsAux * ropes are strings (insert obscene joke here) * optimize JS code gen * optimizations and code improvements * more optimizations * final cleanups
* Fixes #20348; only respect the recursion limit if the symbol's generic type ↵Aditya Siram2022-09-221-1/+7
| | | | | has been generated by the compiler (#20377) Fixes #20348
* minor improvements to follow up recent PRs (#20342)metagn2022-09-141-1/+1
| | | | | | put mOpenArrayToSeq in compile-time evaluation whitelist (it was mNone before which was whitelisted), homogenize "ordinal type expected" errors, put overloadable enums in non-experimental manual
* remove unused sfProcvar, "procvar" mentions (#20204)metagn2022-08-241-2/+3
| | | refs #12975. doesn't close it because wProcvar isn't removed
* test removing dollar for objects out of system (#20242)metagn2022-08-241-0/+3
| | | | | | | | | | | * test removing dollar for objects out of system * test & fixes * fix bootstrap * use nimPreviewSlimSystem, test stdlib category * fix test
* top-down type inference, implements rfc 149 (#20091)metagn2022-08-241-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* new .redefine pragma for templates, warn on redefinition without it (#20211)metagn2022-08-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test CI for template redefinitions * adapt asyncmacro * fix quote * fix again * try something else * revert * fix ioselectors_select, disable packages CI * adapt more tests & simplify * more * more * more * rename to redefine, warn on implicit redefinition * basic documentation [skip ci] * Update compiler/lineinfos.nim Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* remove {.this.} pragma, deprecated since 0.19 (#20201)metagn2022-08-231-1/+0
| | | Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* .forbids pragma: defining forbidden tags (#20050)Lancer112112022-07-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * .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>
* Stop type aliases from inheriting sfUsed (#19861)quantimnot2022-06-041-1/+1
| | | | | Fixes #18201 Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
* Refactor and doc package handling, module name mangling (#19821)quantimnot2022-05-301-21/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor and doc package handling, module name mangling * Consolidate, de-duplicate and extend package handling * Alter how duplicate module names of a package are handled * Alter how module names are mangled * Fix crash when another package is named 'stdlib' (test case added) * Doc what defines a package in the manual Modules with duplicate names within a package used to be given 'fake' packages to resolve conflicts. That prevented the ability to discern if a module belonged to the current project package or a foreign package. They now have the proper package owner and the names are mangled in a consistent manner to prevent codegen clashes. All module names are now mangled the same. Stdlib was treated special before, but now it is same as any other package. This fixes a crash when a foreign package is named 'stdlib'. Module mangling is altered for both file paths and symbols used by the backends. Removed an unused module name to package mapping that may have been intended for IC. The mapping was removed because it wasn't being used and was complicating the issue of package modules with duplicate names not having the proper package owner assigned. * Fix some tests * Refactor `packagehandling` * Remove `packagehandling.withPackageName` and its uses * Move module path mangling from `packagehandling` to `modulepaths` * Move `options.toRodFile` to `ic` to break import cycle * Changed import style to match preferred style Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
* move assertions out of system (#19599)flywind2022-03-231-0/+3
|
* nvro don't touch cdecl types [backport: 1.6] (#19461)flywind2022-01-281-1/+1
| | | * nvro don't touch cdecl types; fix #19342 again
* fixes an old ARC bug: the produced copy/sink operations don't copy the ↵Andreas Rumpf2021-12-091-1/+1
| | | | hidden type field for objects with enabled inheritance; fixes #19205 [backport:1.6] (#19232)
* fixes #19013 [backport:1.6] (#19111)Andreas Rumpf2021-11-091-0/+8
| | | | | * fixes #19013 [backport:1.6] * added test case
* define `nimVersion` automatically and avoid needing -d:nimVersion140 (#18726)Timothee Cour2021-10-171-1/+1
| | | | | * define `nimVersion` and avoid needing -d:nimVersion140 * fix changelog
* correct effect tracking for .borrowed procs [backport] (#18882)Andreas Rumpf2021-09-231-1/+1
| | | | | | | | | | | * correct effect tracking for .borrowed procs [backport] * progress * fix error message in a test * correctly fix it Co-authored-by: narimiran <narimiran@disroot.org>
* strict effects (#18777)Andreas Rumpf2021-09-021-2/+4
| | | | | | | | | | | | | | | | | * 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
* move PNode.comment to a side channel, reducing memory usage during ↵Timothee Cour2021-08-291-21/+56
| | | | | | | | | | | | | | | | | compilation by a factor 1.25x (#18760) * move PNode.comment so a side channel, reducing memory usage * fix a bug * fixup * use sfHasComment to speedup comment lookups * fix for IC * Update compiler/parser.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* replace wrt with proper word (#18724)flywind2021-08-221-1/+1
| | | | | * what does wrt mean? * clarify
* fix #18627(Program segfaults with ARC when using openArray[string]) (#18713)flywind2021-08-191-1/+1
| | | | | | | * fix #18627 * add testcase * rename * another * remove tyVarargs
* improvements to `addInt` and `$` for integer types (#18592)Timothee Cour2021-08-191-4/+4
| | | | | | | | * improvements to $(SomeInteger) and addInt * remove mIntToStr, mInt64ToStr * improvements * fix tests/pragmas/tinjectstmt.nim; the diff is harmless, cgen code is identical with -d:danger or debug mode * rm tests/system/tstrmantle.nim * revert compiler/jsgen.nim for -d:nimVersion140
* allow building 1.4.0 from devel (#18708)Timothee Cour2021-08-181-2/+6
| | | | | * allow building 1.4.0 from devel * changelog
* implements overloadable enum values; WIP (#18470)Andreas Rumpf2021-07-281-1/+1
| | | | | * implements overloadable enum values * simpler code
* fixes #12815 (#18554)Andreas Rumpf2021-07-221-1/+1
|
* make -d:nimFpRoundtrips work consistently in vm vs rt, fix #18400, etc (#18531)Timothee Cour2021-07-201-2/+2
| | | | | | * compiler/vmhooks: add getVar to allow vmops with var params * addFloat vmops with var param * cgen now renders float32 literals in c backend using roundtrip float to string
* nim doc now correctly renders deprecated pragmas for routines and types (#18515)Timothee Cour2021-07-191-0/+31
|
* ORC: support for custom =trace procs (#18459)Andreas Rumpf2021-07-091-1/+1
| | | | | | | | | | | * 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/+1
| | | | | | * ORC refactoring in preparation for further changes (=dispose must die) * ORC: embrace =destroy, avoid =dispose * ORC: no need for =dispose * closes #18421
* fixes #16270 (#18388)Andreas Rumpf2021-06-291-1/+2
|
* fixes #18320 (#18343)Andreas Rumpf2021-06-241-1/+1
| | | | | * TSymFlag has 47 flags already * fixes #18320
* make privateAccess work with generic types and generic instantiations; fix a ↵Timothee Cour2021-06-191-0/+20
| | | | | SIGSEGV (#18260) Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* ORC: improvements (#17993)Andreas Rumpf2021-05-121-2/+2
| | | | * ORC: improvements * ORC: fix .acyclic annotation for ref objects
* add astmsgs; add `declared in` msg for usage lint errors (#17961)Timothee Cour2021-05-081-0/+2
| | | | | | | | | * add astmsgs; add `declared in` msg for usage lint errors * fix test * fix tests/tools/tlinter.nim * std prefix
* fix #17836 (typed macro isNil for proc params) (#17841)Saem Ghani2021-04-251-0/+4
| | | thanks @alaviss for the test
* cString => cSourceString; tyCString => tyCstring so that error msgs show ↵Timothee Cour2021-04-171-3/+3
| | | | cstring, not cString (#17744)
* IC: yet another embarrassing omission (#17743)Andreas Rumpf2021-04-171-1/+1
| | | | | * IC: yet another embarrassing omission * VM: fewer hacks that kept IC from working
* `import foo {.all.}` reboot (#17706)Timothee Cour2021-04-161-4/+4
|
* iterable[T] (#17196)Timothee Cour2021-04-111-2/+4
| | | | | | | | * fix failing test toSeq in manual which now works * changelog * reject proc fn(a: iterable) * add iterable to spec * remove MCS/UFCS limitation that now works
* ast: add getPIdent (#17684)Timothee Cour2021-04-091-0/+8
| | | | | * ast: add getPIdent * fixup
* added nkError to the AST (#17567)Andreas Rumpf2021-03-291-0/+1
| | | | | | | | | | | | | * added nkError to the AST * Update lib/core/macros.nim Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> * Update compiler/ast.nim Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* IC: backend: remember produced type information (#17440)Andreas Rumpf2021-03-231-11/+4
|