summary refs log tree commit diff stats
path: root/compiler/semexprs.nim
Commit message (Collapse)AuthorAgeFilesLines
* fixes #17656 (#17657)Andreas Rumpf2021-04-071-1/+2
|
* implement RFCs/294 ; disallow enum <=> enum conversion (#16351)Timothee Cour2021-04-031-0/+5
| | | | | | | | | | | * fix https://github.com/nim-lang/RFCs/issues/294 ; disallow enum <=> enum conversion * fix the runnableExamples that was the instigator of this RFC * legacy -d:nimLegacyConvEnumEnum * use -d:nimLegacyConvEnumEnum in important_package nimgame2 * add test for enum cast * improve changelog * add changelog: Changes affecting backward compatibility * cleanup changelog * fix changelog
* 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-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* fixes #11225; generic sandwich problems; [backport:1.2] (#17255)Andreas Rumpf2021-03-091-2/+9
| | | | | * fixes #11225; generic sandwich problems; [backport:1.2] * progress * delegating these symbols must be done via 'bind'
* Fix macros.quote custom op symbol interpolation. (#17256)quantimnot2021-03-051-9/+19
| | | | | | | | | | Provides a workaround/fix for #7589. https://github.com/nim-lang/Nim/issues/7589 Updated docs and tutorial to reflect change. Updated runnableExamples to include an example. Co-authored-by: name <name@example.com>
* when statements branches exit early (#17143)Saem Ghani2021-02-221-0/+1
| | | | | When statement branches exit early outside of nimvm. In nimvm it seems that all sides of the branches must be evaluated as the code gen happens at a later stage, this remains intact.
* fixed dot operator recursive loop & macro suggest (#16922)Saem Ghani2021-02-151-1/+17
| | | | | | | | | | | | | | | | | | * basic stability improvements; refs nimsuggest * fixed dot operator recursive loop & macro suggest * hacky fix for run away dot operator sem check Committing this mostly to make the issue more clear. Perhaps get better feedback. * semExprWithType seems like a better place to check * fixed error messages const case expressions * Clean-up test * stopped the dot operator madness No longer get infinite recursion when seming broken code with a dot operator macro like in jsffi. Co-authored-by: Araq <rumpf_a@web.de>
* use typeof instead type (#16962)flywind2021-02-081-1/+1
|
* IC: bugfixes (WIP) (#16836)Andreas Rumpf2021-02-021-2/+2
| | | | | | | | * minor improvements * IC: added the required logic for compilerProcs * LazySym ftw * we need this testing logic * reimplement the old way we use for module package creation * fixes a regression; don't pick module names if you can avoid it
* IC: next steps (#16705)Andreas Rumpf2021-01-141-5/+13
| | | | | | | | | | | * 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 (#16550)Andreas Rumpf2021-01-071-17/+11
| | | | | | | | | | | | | | | | | | * 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
* fix `is "closure"` (#16552)flywind2021-01-021-2/+1
|
* big steps torwards an efficient, simple IC implementation (#16543)Andreas Rumpf2021-01-021-5/+5
| | | | | | | | | | | | | | | | | | | * 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>
* refactorings to prepare the compiler for IC (#15935)Andreas Rumpf2020-12-171-5/+26
| | | | | | | | | | | | | | * 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
* fix #16150 improve type mismatch errors (#16152)Timothee Cour2020-12-091-1/+1
| | | | | | | * fix #16150 improve type mismatch errors * allow -d:nimLegacyTypeMismatch * address comment
* cmdline: improve command processing (#16056)Timothee Cour2020-11-261-2/+2
|
* Disallow nil dereference at compile time (#16032)cooldome2020-11-181-0/+5
| | | | | | | | | | | | | * bring back the semfold of nil * remove space * fix test * proc type can't be dereferenced * disallow nil dereference at compile time * changelog
* Correct all eggs (#15906)Miran2020-11-101-1/+1
| | | | * "eg" is a misspelled "egg", "e.g." is "exempli gratia" * Also, "ie" is "i.e.".
* honor --declaredLocs in more places, including type mismatch errors; also ↵Timothee Cour2020-10-271-2/+3
| | | | | | | show `kind` with --declaredLocs (#15673) * honor --declaredLocs in more places, including type mismatch errors * fix tests * show declaration location also when type mismatch names clash
* explicit ID generation for easier IC (#15559)Andreas Rumpf2020-10-251-28/+26
| | | | | | | | | | | | | | | | | * 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)
* spec for view types (#15424)Andreas Rumpf2020-09-291-3/+3
| | | | | | | | | | | * 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
* better support for slices as views (#15414)Andreas Rumpf2020-09-271-4/+6
| | | | | | * moved view tests to tests/views * refactoring * more refactorings * better support for system.toOpenArray for first class view types
* Fix #15389 (#15390)cooldome2020-09-241-7/+11
| | | | | | | | | * allow result symbol reuse * try different approach * Revert "try different approach" This reverts commit abcfb6b75983c2f798cc887342ff1a9ff10c0324.
* borrow checking (#15282)Andreas Rumpf2020-09-091-9/+12
| | | | | | | | | | | * refactoring: move procs to typeallowed.nim * frontend preparations for first class openArray support * prepare the code generator for first class openArray * code generation for first class openArray; WIP * code generation for open arrays, progress * added isViewType proc * preparations for borrow checking * added borrow checking to the front end
* Expand hoisted default params in sem (#15270)Clyybber2020-09-051-7/+52
| | | | | | | | | * 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-1/+1
|
* Fix #5691 (#15158)Clyybber2020-08-271-20/+22
| | | | | | | | * Fix #5691 * Cleanup and thoughts * Use scope approach * Seperate defined/declared/declaredInScope magics * Fix declaredInScope * Update spec accordingly
* Fix forward declaration issues in template/macro context (#15091)Clyybber2020-07-291-12/+1
| | | | | | | | | | | | | | | | | | | | | | | * Fix forward declaration issues in template/macro context * Correct forward declaration resolving for overloads * Remove old dead code * WIP consistent gensym ids * Minimize diff * Remove obsoleted hack * Add templInstCounter to give unique IDs to template instantiations * Remove obsoleted code * Eh, init in myOpen, not myProcess... * Remove optNimV019 * Add testcase for #13484
* fix #6608 (#14963)flywind2020-07-141-1/+10
| | | | * fix #6608
* Fix #14911 (#14922) [backport]Clyybber2020-07-071-1/+1
| | | | | | | * Fix #14911 * Add testcase * Fix test
* Reject casts to builtin typeclasses (#14788)Danil Yarantsev2020-06-241-0/+2
| | | | | * Closes #14231, closes #14452 * Merge test to tcast.nim
* init checks and 'out' parameters (#14521)Andreas Rumpf2020-06-231-3/+3
| | | | | | | | | | | * 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
* * honor --errorMax even for tools (eg drnim, nim doc) (#14546)Timothee Cour2020-06-021-2/+1
| | | * fix a bug that prevented nim doc compiler/nim on windows
* Fix `compiles` for nimsuggest [backport] (#14527)Danil Yarantsev2020-06-011-0/+7
| | | | * Handle nimsuggest in tryExpr * Added test
* fixes #14498 [backport:1.2] (#14503)Andreas Rumpf2020-05-301-1/+1
|
* make it easier to figure out how to debug issues (#14477)Timothee Cour2020-05-281-4/+5
|
* `nim doc --backend:js`, `nim doc --doccmd:-d:foo`, `nim r --backend:js`, ↵Timothee Cour2020-05-111-1/+1
| | | | | | | | | | `--doccmd:skip` + other improvements (#14278) * `nim doc --backend:js|cpp...` `nim doc --doccmd:'-d:foo --threads:on'` `nim r --backend:cpp...` (implies --run --usenimcache) * --usenimcache works with all targets * --docCmd:skip now skips compiling snippets; 50X speedup for doc/manual.rst
* allow generic typedesc field access (#12220)Jasper Jenkins2020-04-201-57/+53
| | | Co-authored-by: Clyybber <darkmine956@gmail.com>
* fixes #12741 (#14005)Andreas Rumpf2020-04-191-7/+9
| | | | * fixes #12741 * updated tests
* error msg for #13864 (#13962)cooldome2020-04-131-0/+5
| | | Co-authored-by: cooldome <ariabushenko@bk.ru>
* fix #13848: make var result work with nim cpp (#13959)Timothee Cour2020-04-131-1/+5
| | | | | * fix #13848 * add exhaustive tests for var result
* fix ICE in isUnresolvedSym (#13925)cooldome2020-04-081-5/+6
| | | Co-authored-by: cooldome <ariabushenko@bk.ru>
* Turn some of the errors back into warningsZahary Karadjov2020-04-011-14/+0
|
* Replace tfHasRequiresInit with a more accurate mechanismZahary Karadjov2020-04-011-4/+10
| | | | | | | | | The new mechanism can deal with more complex scenarios such as not nil field appearing in a non-default case object branch or a field within a generic object that may depend on a when branch. The commit also plugs another hole: the user is no longer able to create illegal default values through seq.setLen(N).
* Fix tests/parallel/tguard2.nimZahary Karadjov2020-04-011-1/+1
|
* Fix https://github.com/nim-lang/Nim/issues/4907Zahary Karadjov2020-04-011-0/+3
|
* Perform nil checks during object construction and within compiles()Zahary Karadjov2020-04-011-1/+4
| | | | Close https://github.com/nim-lang/Nim/issues/6494
* not nil types are illegal to construct through default(T)Zahary Karadjov2020-04-011-0/+2
|
* Enable the requiresInit checks only for objectsZahary Karadjov2020-04-011-1/+1
|