summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
Commit message (Collapse)AuthorAgeFilesLines
* [nim check]fix #17460 (#17569)flywind2021-03-291-0/+2
|
* custom integer literals (#17489)Andreas Rumpf2021-03-241-1/+1
| | | | | | | * user defined integer literals; refs #17020 * updated renderer.nim * use mlexerutils helper * imported all test cases from https://github.com/nim-lang/Nim/pull/17020 * final grammar updated
* semTemplateDef and t17433 clean-ups (#17448)Saem Ghani2021-03-221-18/+0
| | | | | - use `doAssert` in t17433 - use setGenericParamsMisc in semTemplateDef akin to semProcAux - pragma handling in semTemplateDef inline with semProcAux
* semLambda removed, semProcAux reworked (#17379)Saem Ghani2021-03-171-177/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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/+2
| | | | | * fixes #11225; generic sandwich problems; [backport:1.2] * progress * delegating these symbols must be done via 'bind'
* new-style concepts implementation, WIP (#15251)Andreas Rumpf2021-02-241-1/+1
| | | | | | | | | | | | | * 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)
* rename case statement macro from match to `case` (#16923)hlaaftana2021-02-081-3/+3
| | | | | * rename case statement macro from match to `case` * fix test
* 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
* remove conditionals on nimHasUserErrors, nimNoNilSeqs2, nimNoNilSeqs (#16861)Timothee Cour2021-01-291-4/+1
| | | | | | | | | * cleanup docs for type(nil) | type(nil); simplify nimHasUserErrors * simplify nimNoNilSeqs2 * simplify nimNoNilSeqs * fixup
* IC: final implementation steps (#16801)Andreas Rumpf2021-01-251-2/+2
| | | | | | | | * removed dead code * we need even more laziness for the generic caches * make it bootstrap on older Nims * wrote more deserialization code * IC: replay required methods information
* IC: next steps (#16729)Andreas Rumpf2021-01-231-10/+13
| | | | | | | | | | | * 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-2/+0
| | | | | | | | | | | * 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-6/+6
| | | | | | | | | | | | | | | | | | * 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-6/+7
| | | | | | | | | | | | | | | | | | | * 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-4/+6
| | | | | | | | | | | | | | * 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
* fixes #16119 [backport:1.4] (#16149)Andreas Rumpf2020-11-261-3/+3
|
* More on #16110 (#16130)cooldome2020-11-261-2/+11
| | | | | | | | | | | * fix #16110 * refs #16110 * fix comment * Trigger build * use shallowCopy for efficiency
* fix #16110 (#16117)cooldome2020-11-241-1/+2
|
* Revert "fix #16110"Andrey R (cooldome)2020-11-241-2/+1
| | | | This reverts commit 2bab2a2cd8476423414819db3ad79309f6033e13.
* fix #16110Andrey R (cooldome)2020-11-241-1/+2
|
* fix #15972 (#15994)flywind2020-11-181-2/+2
| | | | | | | * fix #15972 * add testcase * more
* Correct all eggs (#15906)Miran2020-11-101-1/+1
| | | | * "eg" is a misspelled "egg", "e.g." is "exempli gratia" * Also, "ie" is "i.e.".
* Make `{.requiresInit.}` to work for distinct types (#15869)Ivan Bobev2020-11-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make `requiresInit` pragma to work for distinct types in addition to objects. Tagging of distinct types with `requiresInit` pragma was already supported, but its impact wasn't applied. Now its behavior when applied on distinct types is as follows. Given the following distinct type definitions: ```nim type DistinctObject {.requiresInit, borrow: `.`.} = distinct MyObject DistinctString {.requiresInit.} = distinct string ``` The following code blocks will fail to compile: ```nim var foo: DistinctFoo foo.x = "test" doAssert foo.x == "test" ``` ```nim var s: DistinctString s = "test" doAssert s == "test" ``` But these ones will compile successfully: ```nim let foo = DistinctFoo(Foo(x: "test")) doAssert foo.x == "test" ``` ```nim let s = "test" doAssert s == "test" ```
* explicit ID generation for easier IC (#15559)Andreas Rumpf2020-10-251-22/+22
| | | | | | | | | | | | | | | | | * 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)
* renamed '=' to '=copy' [backport:1.2] (#15585)Andreas Rumpf2020-10-151-2/+2
| | | | | | | | | * 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>
* suggest: try to find the implementation of a symbol when def is used (#15555)alaviss2020-10-141-0/+1
| | | | | * suggest: try to find the implementation of a symbol when def is used * suggest: return all declarations of the symbol on `def`
* implements https://github.com/nim-lang/RFCs/issues/258 (#15503)Andreas Rumpf2020-10-061-1/+1
| | | | | | | | | * implements https://github.com/nim-lang/RFCs/issues/258 * don't be too strict with custom pragma blocks * cast pragmas: documentation * added most missing inference query procs to effecttraits.nim
* Fix #15389 (#15390)cooldome2020-09-241-17/+16
| | | | | | | | | * allow result symbol reuse * try different approach * Revert "try different approach" This reverts commit abcfb6b75983c2f798cc887342ff1a9ff10c0324.
* Fix forward declarations in shadow scope contexts (#15386)Clyybber2020-09-221-4/+5
| | | | | | | | | | | | | | | * Fix forward declarations in shadow scope contexts * Add testcase for #15385 * Less empty lines * Fix tests * Inline isShadowScope * Add original testcase (with reduced amount of iterations) * Add testcase without forward decl
* fixes #15360 [backport:1.2] (#15378)Andreas Rumpf2020-09-211-1/+1
|
* borrow checking (#15282)Andreas Rumpf2020-09-091-2/+2
| | | | | | | | | | | * 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
* "for-loop macros" are no longer an experimental feature (#15288)Miran2020-09-081-3/+2
|
* don't raise index defects on malformed ast (#15278)Andy Davidoff2020-09-071-3/+6
| | | | | * don't raise index defects on malformed ast * style
* 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
* fixes a collect() bug reported on the forum (#15156) [backport:1.2]Andreas Rumpf2020-08-041-1/+1
|
* Fix forward declaration issues in template/macro context (#15091)Clyybber2020-07-291-2/+4
| | | | | | | | | | | | | | | | | | | | | | | * 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
* scoped memory management (#14790)Andreas Rumpf2020-07-041-2/+2
| | | | | | | * fixes the regressions * closes #13936 * scope based memory management implemented * enabled tcontrolflow.nim test case * final cleanups
* Clean out oldast (#14837)Juan Carlos2020-06-301-16/+12
| | | | * Clean out old Deprecated CLI switch * Update to remove --oldast CLI option
* Make unreachable code a warning instead of an error (#14816)Clyybber2020-06-291-4/+2
| | | | | | | * Make unreachable code a warning * Adapt test * Trigger CI
* init checks and 'out' parameters (#14521)Andreas Rumpf2020-06-231-14/+4
| | | | | | | | | | | * 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
* misc cleanups in compiler msgs: use toHumanStr, etc (#14677)Timothee Cour2020-06-151-2/+1
|
* disallow typedesc in arrays & move existing checks to `types.typeAllowedAux` ↵Neelesh Chandola2020-05-291-24/+21
| | | | | | (#13261) * disallow typedesc in arrays and move previous checks to types.typeAllowedAux
* Allow let to not have value when using importc (#14258)PMunch2020-05-121-2/+3
| | | | | | | | | | | | | | * Allow let to not have value when using importc This allows a let statement with the `{.importc.}` pragma to not be initialised with a value. This allows us to declare C constants as Nim lets without putting the value in the Nim code (which can lead to errors, and requires us to go looking for the value). Fixes #14253 * Proper fix and documentation + changelog entry * Improve testcase with one from timotheecour * Add test to verify it working with macros
* improve the 'has to be discarded' error messageAraq2020-05-021-2/+2
|
* Make unreachable else in case statements a warning instead of an error (#14190)Clyybber2020-05-021-1/+1
| | | | | * Fix #14019 by making trailing else a warning * Rename to UnreachableElse
* Make ./koch temp --gc:arc work (#14186)Clyybber2020-05-011-1/+1
|
* fixes #12741 (#14005)Andreas Rumpf2020-04-191-2/+2
| | | | * fixes #12741 * updated tests
* fix #13909 (#13914) [backport:1.2]cooldome2020-04-081-3/+8
| | | Co-authored-by: cooldome <ariabushenko@bk.ru>
* Replace tfHasRequiresInit with a more accurate mechanismZahary Karadjov2020-04-011-2/+4
| | | | | | | | | 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).
* Turn the warning for uninitialized (result) variables into errorsZahary Karadjov2020-04-011-3/+2
|