summary refs log tree commit diff stats
path: root/compiler/ast.nim
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* IC: green tests (#17311)Andreas Rumpf2021-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * IC: renamed to_packed_ast module to ic module * IC: don't store the --forceBuild flag, makes it easier to test * IC: enable hello world test * Codegen: refactorings for IC; changed the name mangling algorithm * fixed the HCR regressions * life is too short for HCR * tconvexhull is now allowed to use deepCopy * IC exposed a stdlib bug, required a refactoring * codegen: code cleanups * IC: even if a module is outdated, its dependencies might come from disk * IC: progress * IC: better name mangling, module IDs are not stable * IC: another refactoring helping with --ic:on --gc:arc * disable arraymancer on Windows for the time being * disable arraymancer altogether * IC: make basic test work with 'nim cpp' * IC: progress on --ic:on --gc:arc * wip; name mangling for type info
* semLambda removed, semProcAux reworked (#17379)Saem Ghani2021-03-171-6/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * simplified proc-like name ident to symbol code * wip - reworking generic param sem * wip - closer to removing nkEmpty generic params * it's hacky but tests pass * slowly tweaking semProcAux to take on semLambda * fix pragma superset check proto vs current * Set the symbol owner earlier * partial progress reworking proto found bug where default values between forward and impl lead to overload resolution issues. * simplified pragma handling and callConv checks Co-authored-by: Clyybber <Clyybber@users.noreply.github.com> * partially working * cgexprs issue * It works! * comment clean-up * clean-up asserts, comments, and other bits * add isGenericParams, inline isGeneric queries * seeing if this is sufficiently consistent * can use this approach or continue it in a further PR * commentary about nullary generics and clean-ups * fixed a mistake in PNode isGenericRoutine * Some small cleanups * Small cleanup * for func lambdas ensure we use lambda pragmas * add some basic compileTime func tests * [ci skip] remove comments Co-authored-by: Clyybber <Clyybber@users.noreply.github.com> Co-authored-by: Clyybber <darkmine956@gmail.com>
* new-style concepts implementation, WIP (#15251)Andreas Rumpf2021-02-241-3/+6
| | | | | | | | | | | | | * fixes #15210 [backport:1.2] * make tests green * make ordinal work * makes Swapable test compile * make Indexable example work * concepts: 'self' is now 'Self' * concepts: make Dictionary example compile * document the new concept implementation * concepts: make typeDesc work properly * concepts: allow documentation comments (d'oh)
* ARC Analysis in one pass v3 (#17068)Clyybber2021-02-171-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Analyse last reads all at once * Integrate firstWrite analysis * Small cleanup * Use sets instead of seqs * Remove instrTargets * Reap the benefits * Implement error diagnostics * Operate on DFA index for lastRead analysis * Use mgetOrPut * Cache alias results This improves performance by a lot, since many CFG locations map to a single PNode * Improve performance * Improve performance * Cleanup * Fix #17025 * Grammar * Expand testcase
* Revert "ARC: Analysis in one pass v2 (#17000)" (#17046)Clyybber2021-02-151-3/+1
| | | This reverts commit 216be4060a853b3425501318537d598c4842eefc.
* ARC: Analysis in one pass v2 (#17000)Clyybber2021-02-101-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Analyse last reads all at once * Integrate firstWrite analysis * Small cleanup * Use sets instead of seqs * Remove instrTargets * Reap the benefits * Implement error diagnostics * Operate on DFA index for lastRead analysis * Use mgetOrPut * Cache alias results This improves performance by a lot, since many CFG locations map to a single PNode * Improve performance * Improve performance * Cleanup
* Revert "ARC Analysis in one pass (#16849)" (#16984)Clyybber2021-02-091-3/+1
| | | This reverts commit ab740cb5b9bfbacece26956fa2444763a790ccd1.
* ARC Analysis in one pass (#16849)Clyybber2021-02-091-1/+3
| | | | | | | | | | | | | | | | | | | * Analyse last reads all at once * Integrate firstWrite analysis * Small cleanup * Use sets instead of seqs * Remove instrTargets * Reap the benefits * Implement error diagnostics * Operate on DFA index for lastRead analysis * Use mgetOrPut
* remove conditionals on nimHasUserErrors, nimNoNilSeqs2, nimNoNilSeqs (#16861)Timothee Cour2021-01-291-32/+5
| | | | | | | | | * cleanup docs for type(nil) | type(nil); simplify nimHasUserErrors * simplify nimNoNilSeqs2 * simplify nimNoNilSeqs * fixup
* fix #16752: threadvar now works with importcpp types; osx now uses native ↵Timothee Cour2021-01-271-0/+4
| | | | | | | | | | | TLS (`--tlsEmulation:off`), which can be orders of magnitude faster (#16750) * osx now uses native TLS, which can be orders of magnitude faster * add {.cppNonPod.} * improve test * changelog, docs, disable part of windows test
* IC: next steps (#16729)Andreas Rumpf2021-01-231-20/+36
| | | | | | | | | | | * IC: dead code elimination pass * preparations for a different codegen strategy * added documentation to the newly written code * IC: backend code * IC: backend adjustments * optimized the compiler a bit * IC: yet another massive refactoring * fixes regressions * cleanups
* IC: next steps (#16705)Andreas Rumpf2021-01-141-1/+2
| | | | | | | | | | | * code cleanups * refactorings for IC * more refactorings for IC * IC: attach the 'nil' type to its module * IC: refactorings and improvements * IC: progress * IC: more serialization fixes * IC: embarrassing omission * code cleanups
* IC: next steps (#16632)Andreas Rumpf2021-01-121-0/+5
| | | | | | | | | | | | | * removed dead code * beginnings of a rodfile reader * IC: record global VM state changes and pragma state changes * IC: replay pragmas and VM state changes * implemented rod load file simuation for easier, extensive testing * critical bugfix * IC: stress test logic; should also help with recursive module dependencies; WIP * IC: loading from .rod files begins to work reliably * removed ugly hacks * yet another silly mistake
* IC: next steps (#16550)Andreas Rumpf2021-01-071-19/+0
| | | | | | | | | | | | | | | | | | * cleanups * ast.nim: cleanups * IC: no more sym.tab field, stored externally in the module graph * nimble compiles again * rodfiles: store bitwidth of integers and the endianness in the cookie because we serialize 'int' directly * rodfiles: added compilerproc and export sections * rodfiles: added all the missing sections * rodfiles: track the missing information * IC: architecture for lazy loading of proc bodies * make tests green again * completed the lazy loading of proc bodies * symbol lookup integration, part 1 * symbol lookup integration, part 2 * symbol lookup integration, part 3 * make tcompilerapi work again * rodfiles: fixed config change handling
* big steps torwards an efficient, simple IC implementation (#16543)Andreas Rumpf2021-01-021-7/+24
| | | | | | | | | | | | | | | | | | | * reworked ID handling * the packed AST now has its own ID mechanism * basic serialization code works * extract rodfiles to its own module * rodfiles: store and compare configs * rodfiles: store dependencies * store config at the end * precise dependency tracking * dependency tracking for rodfiles * completed loading of PSym, PType, etc * removed dead code * bugfix: do not realloc seqs when taking addr into an element * make IC opt-in for now * makes tcompilerapi green again * final cleanups Co-authored-by: Andy Davidoff <github@andy.disruptek.com>
* Nil type check implementation (#15287)Alexander Ivanov2020-12-291-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Nil checking * Enable current older not nil checking again, run new checking only under flag, skip our test * Enable tests, work on try/except and bugs, fix notnil tests * Enable strictNotNil tests (currently with lowercase category) and add some expected output * Work on try/except/finally: still some things unclear and a lot of code can raise out of try * Fix the notnil build by going back to the old version of a test which I shouldn't have changed * Fix test : use action compile * Work on mutation and aliasing: not finished * Render var parititions graph, try to understand it, fix a nilcheck if bug * Rebase, progress on working with partitions * Improve time logic * Fix some bugs, use graph indices instead of symbol in nil map * Fix bugs, test simpler ident aliasing for now, support two mutation levels * Support ContentMutation and ReAssignment: for now just detect possible re assignment for var parameters of calls * Enable several simple passing tests * Cleanup a bit, fix condition/branch infix-related bug * Remove some files, address some comments by Araq * Use internalError and no quit for now * Separate tests with expected warnings and with expected ok, fix a bug with if with a single branch related to copyMap * Fix new data structures, bugs: make tests pass, disable some for now * Work on fixing errors with non-sym nodes, aliasing: tests fail * Work on alias support: simple set-based logic, todo more tests and ref sets? * Use ref sets: TODO can we think of handle seq-s similar to varpartitions' Araq ones * Handle defers in one place, stop raising in reverse to make an async test compile with strictNotNil, add a commented out test * Dot expressions: call/reassignment. Other refactorings and distinct, SeqOfDistinct support. Checkout an older varpartitions * Work on field tracking * Backup : trying to fix bugs when running some stdlib stuff for running an async test * Start a section about strict not nil checking in experimental manual * Fix experimental strict not nil manual section and move it to another file based on Araq feedback * Fix unstructured flow and double warning problems, fix manual, cleanup * Fix if/elif/else : take in account structure according to Araq feedback * Refactor a bit * Work on bracket expr support, re-enable tests, clarify in manual/tests/implementation static index support for now * Work on compiling stdlib and compiler with strictNotNil * Small fixes to the manual for strictNotNil * Fix idgen for strict check nil rebase * Enable some simple tests, remove old stuff, comment out code/print * Copy the original varpartitions source instead of my changes * Remove some files
* refactorings to prepare the compiler for IC (#15935)Andreas Rumpf2020-12-171-1/+3
| | | | | | | | | | | | | | * added ic specific Nim code; WIP * make the symbol import mechanism lazy; WIP * ensure that modules can be imported multiple times * ambiguity checking * handle converters and TR macros properly * make 'enum' test category green again * special logic for semi-pure enums * makes nimsuggest tests green again * fixes nimdata * makes nimpy green again * makes more important packages work
* cmdline: improve command processing (#16056)Timothee Cour2020-11-261-1/+1
|
* fixes #16069; [backport:1.2] [backport:1.4] (#16115)Andreas Rumpf2020-11-241-1/+1
| | | | | * fixes #16069; refs https://github.com/nim-lang/RFCs/issues/257 [backport:1.2] [backport:1.4] * make tests green again
* ast minor (#16079)flywind2020-11-221-0/+1
|
* fix #6497 (#16027)flywind2020-11-181-0/+1
| | | | | * fix #6497 * add testcase for #16027
* rename: stmt -> typed and expr -> untyped (#15989)flywind2020-11-161-1/+1
| | | | | | | * stmt -> typed * expr -> untyped * minor
* Use modern enums in compiler (#15775)cooldome2020-11-021-15/+11
|
* explicit ID generation for easier IC (#15559)Andreas Rumpf2020-10-251-32/+61
| | | | | | | | | | | | | | | | | * refactoring: idents don't need inheritance * refactoring: adding an IdGenerator (part 1) * refactoring: adding an IdGenerator (part 2) * refactoring: adding an IdGenerator (part 3) * refactoring: adding an IdGenerator (part 4) * refactoring: adding an IdGenerator (part 5) * refactoring: adding an IdGenerator (part 5) * IdGenerator must be a ref type; hello world works again * make bootstrapping work again * progress: add back the 'exactReplica' ideas * added back the missing exactReplica hacks * make tcompilerapi work again * make important packages green * attempt to fix the build for 32 bit machines (probably need a better solution here)
* even more "eg" fixes [ci skip]narimiran2020-10-201-1/+1
|
* renamed '=' to '=copy' [backport:1.2] (#15585)Andreas Rumpf2020-10-151-1/+1
| | | | | | | | | * Assign hook name changed to `=copy` * Adapt destructors.rst * [nobackport] Duplicate tests for =copy hook * Fix tests * added a changelog entry Co-authored-by: Clyybber <darkmine956@gmail.com>
* spec for view types (#15424)Andreas Rumpf2020-09-291-3/+0
| | | | | | | | | | | * spec for view types * spec additions * refactoring; there are two different kinds of views * refactorings and spec additions * enforce that view types are initialized * enforce borrowing from the first formal parameter * enforce lifetimes for borrowing of locals * typo in the manual * clarify in the implementation what a borrow operation really is
* .noalias annotation; frontend support (#15419)Andreas Rumpf2020-09-281-2/+3
| | | | | * .noalias annotation; frontend support * added .noalias support to Nim; implements https://github.com/nim-lang/RFCs/issues/204
* allow old styled RTTI for arc/orc (#15331)Andreas Rumpf2020-09-161-1/+1
|
* fix warnings for deprecated `low` and `high` (#15291)Miran2020-09-111-2/+2
|
* Expand hoisted default params in sem (#15270)Clyybber2020-09-051-41/+37
| | | | | | | | | * Expand hoisted default params in sem Introduce ast.newTree{I,IT} Add test for default params in procs * Cleanup * Simplify hoist transformation and expand test
* Big compiler Cleanup (#14777)Clyybber2020-08-281-18/+16
|
* Fix #5691 (#15158)Clyybber2020-08-271-1/+1
| | | | | | | | * Fix #5691 * Cleanup and thoughts * Use scope approach * Seperate defined/declared/declaredInScope magics * Fix declaredInScope * Update spec accordingly
* Use typeflag insteadClyybber2020-08-101-5/+3
|
* Make explicit {.nimcall.} a seperate calling conventionClyybber2020-08-081-2/+5
|
* cursor and mutation tracking fixes (#15113)Andreas Rumpf2020-07-301-0/+9
| | | | | | | | * fixes #15110 * fixes #15096 * prepare varpartitions for cursor inference * new cursor inference begins to work * make tests green
* fixes #15036Andreas Rumpf2020-07-231-1/+2
|
* 'isolate' builtin; refs https://github.com/nim-lang/RFCs/issues/244 (#15011)Andreas Rumpf2020-07-201-1/+1
|
* fix #14802 (#14803)Timothee Cour2020-06-251-1/+2
|
* minor bugfixes for 'func' and .borrowAraq2020-06-231-1/+1
|
* init checks and 'out' parameters (#14521)Andreas Rumpf2020-06-231-4/+8
| | | | | | | | | | | * I don't care about observable stores * enforce explicit initializations * cleaner code for the stdlib * stdlib: use explicit initializations * make tests green * algorithm.nim: set result explicitly * remove out parameters and bring the PR into a mergable state * updated the changelog
* added a spaceAraq2020-06-191-1/+1
|
* remove tyOpt, mOpt (#14636)Timothee Cour2020-06-121-5/+5
| | | | | * remove tyOpt, mOpt * fixup
* more precise analysis about 'observable stores' [backport:1.2] (#14582)Andreas Rumpf2020-06-061-0/+1
|
* fix #8871 runnableExamples now preserves source code comments, litterals, ↵Timothee Cour2020-05-281-0/+1
| | | | | | | | | | | and all formatting; other bug fix (#14439) * fix #8871 runnableExamples now preserves source code comments, litterals, and all formatting * remove orig deadcode from getAllRunnableExamplesImpl * fix expected examples * add test to close https://github.com/nim-lang/Nim/issues/14473 * correctly handle regular comments before 1st token inside runnableExamples * add test to answer https://github.com/nim-lang/Nim/pull/14439#discussion_r431829199 * update tests
* Add thiscall calling convention, mostly for hooking purpose (#14466)Huy Doan2020-05-271-1/+2
| | | | * Add thiscall calling convention, mostly for hooking purpose * add changelog and documentation
* Error -> Defect for defects (#13908)Jacek Sieka2020-04-281-1/+1
| | | | | | | | | | | | | | * Error -> Defect for defects The distinction between Error and Defect is subjective, context-dependent and somewhat arbitrary, so when looking at an exception, it's hard to guess what it is - this happens often when looking at a `raises` list _without_ opening the corresponding definition and digging through layers of inheritance. With the help of a little consistency in naming, it's at least possible to start disentangling the two error types and the standard lib can set a good example here.
* CT sizeof(+friends) for {.importc, completeStruct.} types, enable ABI static ↵Timothee Cour2020-04-231-0/+3
| | | | | | | | | | | checks (#13926) * -d:checkabi obsolete (ABI check now enforced); add `addTypeHeader` helper * cleanups * import sizeof at CT for {.completeType.} * address comments; revert default enabling of -d:checkAbi for now * mimportc_size_check.nim => msizeof5.nim; merge mabi_check.nim into msizeof5.nim; refactor * all pragmas in errmsgs should be written: '.importc' (un-ambiguous and less verbose than {.importc.})