summary refs log tree commit diff stats
path: root/compiler/semtempl.nim
Commit message (Collapse)AuthorAgeFilesLines
* underscores for routine parameters (#21192)metagn2023-01-081-2/+3
| | | | | | | | | * underscores for routine parameters fixes #13443, fixes #13804, refs #21121 * add changelog + more tests * support generics and ensure inferred lambdas work
* deprecate `do:` meaning `do ():` + misc cleanup (#20927)metagn2022-12-061-1/+1
| | | | | | | | | | | | | | | | | * test disable do: block lambda lifting * fix last test [skip ci] * deprecate `do:` meaning `do ():` + misc cleanup closes https://github.com/nim-lang/RFCs/issues/486 * oops * fix * no idea what could be causing nimsuggest failure other than this * ensure ci works
* alternate fix + test for #12094, refs #13804 (#20686)metagn2022-10-291-1/+1
|
* fixes #1027; disallow templates to use ambiguous identifiers (#20631)ringabout2022-10-241-0/+2
| | | | | | | | | | | | | | | | | | | | * test qualifiedLookUp in templates * check later * add testcase * add 4errormsg * Update tests/template/m1027a.nim Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> * Update tests/template/m1027b.nim Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* fixes #20572 (#20585)Andreas Rumpf2022-10-171-1/+1
| | | | | * fixes #20572 * added a test case
* pragma for sfCallsite instead of name check + better semantics, test (#20464)metagn2022-10-031-6/+0
| | | | | | | | | | | * 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 #13515 [backport] (#20315)metagn2022-09-111-1/+7
| | | | | | | | | | | * fix #13515 * only compile test * no idea why this PR is unlocking this * don't rope in symchoices * even more restrictive
* overloadable enums no longer experimental (#20298)metagn2022-09-051-7/+3
| | | depends on #20126
* new .redefine pragma for templates, warn on redefinition without it (#20211)metagn2022-08-231-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* fix #20002 (#20004)metagn2022-07-151-1/+1
| | | | | | While this fix seems innocent, this unlocks the hidden behavior of method calls not being able to call gensym'ed routines inside templates.
* Change `styleCheck` to ignore foreign packages (#19822)quantimnot2022-07-141-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* New/better macro pragmas, mark some as experimental (#19406)metagn2022-01-201-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* fix stylecheck error with asyncdispatch (#19350)flywind2022-01-101-1/+2
| | | | | | | | | | | | | | | | | | | | | * stylecheck usages part two: stdlib cleanup typeinfo.nim: importCompilerProc => importcompilerproc nre.nim: newLineFlags => newlineFlags system.nim: JSRoot => JsRoot ref #19319 * prefer importCompilerProc * fix stylecheck error with asyncdispatch it is a partial regression since #12842 * add tests * don't use echo in tests
* fixes a regression caused by overloadable enums even though they're opt-in ↵Andreas Rumpf2021-10-071-3/+7
| | | | (#18970)
* fixes a 'mixin' statement handling regression [backport:1.2] (#18968)Andreas Rumpf2021-10-071-1/+6
|
* fixes #18863 [backport] (#18871)Andreas Rumpf2021-09-201-3/+4
|
* fix: `var a{.foo.} = expr` inside templates (refs #15920) (except when `foo` ↵Timothee Cour2021-08-111-3/+12
| | | | | | | | | | | is overloaded) (#13869) * fix: `var a{.foo.} = expr` inside templates * add test * improve tdecls test * improve tests * add failing test * PRTEMP * fixup
* Fixed template const tuple unpacking (#18562)Jason Beetham2021-07-231-22/+18
|
* refactoring: removed empty withBracketExpr template (#18152)Andreas Rumpf2021-06-021-10/+4
|
* fix #18113 (#18124)Saem Ghani2021-05-311-2/+6
|
* semTemplateDef and t17433 clean-ups (#17448)Saem Ghani2021-03-221-19/+19
| | | | | - use `doAssert` in t17433 - use setGenericParamsMisc in semTemplateDef akin to semProcAux - pragma handling in semTemplateDef inline with semProcAux
* Fixes #17433; gensym callDef return in templ body (#17445)Saem Ghani2021-03-221-1/+1
|
* semLambda removed, semProcAux reworked (#17379)Saem Ghani2021-03-171-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-3/+7
| | | | | * fixes #11225; generic sandwich problems; [backport:1.2] * progress * delegating these symbols must be done via 'bind'
* Fix #12595 (#16874)konsumlamm2021-01-311-0/+4
|
* IC: next steps (#16550)Andreas Rumpf2021-01-071-1/+1
| | | | | | | | | | | | | | | | | | * 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-1/+1
| | | | | | | | | | | | | | | | | | | * 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>
* explicit ID generation for easier IC (#15559)Andreas Rumpf2020-10-251-3/+3
| | | | | | | | | | | | | | | | | * 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)
* views: yet another bugfix (#15447)Andreas Rumpf2020-10-011-5/+0
| | | | | | | * views: yet another bugfix * views: extended the spec * views: take into account potential hidden mutations via proc calls
* Fix forward declarations in shadow scope contexts (#15386)Clyybber2020-09-221-2/+2
| | | | | | | | | | | | | | | * 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
* Big compiler Cleanup (#14777)Clyybber2020-08-281-1/+0
|
* Fix forward declaration issues in template/macro context (#15091)Clyybber2020-07-291-22/+5
| | | | | | | | | | | | | | | | | | | | | | | * 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 codegen bug due to changing existing symbol declaration in template (#14666)jcosborn2020-06-151-1/+1
|
* fixes #12885 [backport] (#12895)Andreas Rumpf2019-12-131-0/+4
|
* Fixes #12832 (#12842) [backport]Neelesh Chandola2019-12-081-0/+5
| | | | | | * Fix #12832 * nimVm -> nimvm in json.nim * Use suggestSym() instead of markUsed(); Also use styleCheckUse() for finding style violations
* Cosmetic compiler cleanup (#12718)Clyybber2019-11-281-159/+155
| | | | | | | | | | | | | | | | | | * Cleanup compiler code base * Unify add calls * Unify len invocations * Unify range operators * Fix oversight * Remove {.procvar.} pragma * initCandidate -> newCandidate where reasonable * Unify safeLen calls
* fixes #12193 (#12199)Andreas Rumpf2019-09-161-2/+1
|
* Small ast.nim cleanup (#12156)Clyybber2019-09-091-20/+20
| | | | | * Remove sonsLen * Use Indexable
* fixes yet another gensym regression (#12145)Andreas Rumpf2019-09-061-3/+3
|
* fixes #12121 (#12126)Andreas Rumpf2019-09-051-9/+24
|
* improvement for 'unused import' warningsAraq2019-09-021-0/+1
|
* new gensym handling (#11985)Andreas Rumpf2019-08-231-19/+43
| | | | | | | | | | | * new .gensym implementation * make astspec test green again * introduce a --useVersion switch to group compatibility switches * fixes #10180 * fixes #11494 * fixes #11483 * object constructor fields and named parameters are also not gensym'ed * disabled broken package
* [refactoring] compiler: simplified markUsedAndreas Rumpf2019-08-081-1/+1
|
* [feature] detect unused importsAraq2019-07-171-1/+1
|
* Allow void macro result (#11286)Arne Döring2019-05-211-5/+0
| | | | | * allow void macro result * add test for void macro result type
* Fixes #9365 : let with exportC pragma in template. (#11235)Aditya Siram2019-05-141-0/+6
| | | | | | * Fixes #9365 : let with exportC pragma in template. * Fix according to comments.
* rename tyExpr/tyStmt to tyUntyped/tyTyped (#11227)Arne Döring2019-05-111-5/+5
|
* Replace countup(x, y) with x .. yClyybber2019-05-071-4/+4
|
* Replace countup(x, y-1) with x ..< yClyybber2019-05-071-14/+14
|
* Fix loop tuple unpacking in templates (#11174)nc-x2019-05-051-1/+5
| | | | | | * Fix loop tuple unpacking in templates * Add test