summary refs log tree commit diff stats
path: root/compiler/seminst.nim
Commit message (Collapse)AuthorAgeFilesLines
* refactoring: no inheritance for PType/PSym (#23403)Andreas Rumpf2024-03-141-10/+10
|
* nimsuggest --ic:on compiles (#23298)Juan M Gómez2024-02-091-0/+1
|
* delay resolved procvar check for proc params + acknowledge unresolved ↵metagn2024-01-111-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | statics (#23188) fixes #23186 As explained in #23186, generics can transform `genericProc[int]` into a call `` `[]`(genericProc, int) `` which causes a problem when `genericProc` is resemmed, since it is not a resolved generic proc. `[]` needs unresolved generic procs since `mArrGet` also handles explicit generic instantiations, so delay the resolved generic proc check to `semFinishOperands` which is intentionally not called for `mArrGet`. The root issue for [t6137](https://github.com/nim-lang/Nim/blob/devel/tests/generics/t6137.nim) is also fixed (because this change breaks it otherwise), the compiler doesn't consider the possibility that an assigned generic param can be an unresolved static value (note the line `if t.kind == tyStatic: s.ast = t.n` below the change in sigmatch), now it properly errors that it couldn't instantiate it as it would for a type param. ~~The change in semtypinst is just for symmetry with the code above it which also gives a `cannot instantiate` error, it may or may not be necessary/correct.~~ Now removed, I don't think it was correct. Still possible that this has unintended consequences.
* types refactoring; WIP (#23086)Andreas Rumpf2023-12-171-11/+10
|
* type refactoring: part 2 (#23059)Andreas Rumpf2023-12-131-5/+5
|
* fixes #22913; fixes #12985 differently push-ing pragma exportc genera… ↵ringabout2023-11-191-0/+6
| | | | | | | | | | | (#22941) …tes invalid C identifiers fixes #22913 fixes #12985 differently `{.push.} now does not apply to generic instantiations`
* make expressions opt in to symchoices (#22716)metagn2023-09-181-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | refs #22605 Sym choice nodes are now only allowed to pass through semchecking if contexts ask for them to (with `efAllowSymChoice`). Otherwise they are resolved or treated as ambiguous. The contexts that can receive symchoices in this PR are: * Call operands and addresses and emulations of such, which will subject them to overload resolution which will resolve them or fail. * Type conversion operands only for routine symchoices for type disambiguation syntax (like `(proc (x: int): int)(foo)`), which will resolve them or fail. * Proc parameter default values both at the declaration and during generic instantiation, which undergo type narrowing and so will resolve them or fail. This means unless these contexts mess up sym choice nodes should never leave the semchecking stage. This serves as a blueprint for future improvements to intermediate symbol resolution. Some tangential changes are also in this PR: 1. The `AmbiguousEnum` hint is removed, it was always disabled by default and since #22606 it only started getting emitted after the symchoice was soundly resolved. 2. Proc setter syntax (`a.b = c` becoming `` `b=`(a, c) ``) used to fully type check the RHS before passing the transformed call node to proc overloading. Now it just passes the original node directly so proc overloading can deal with its typechecking.
* Instantiates generics in the module that uses it (#22513)Juan M Gómez2023-09-091-2/+21
| | | | | | | | | | Attempts to move the generic instantiation to the module that uses it. This should decrease re-compilation times as the source module where the generic lives doesnt need to be recompiled --------- Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* better initialization patterns for seminst (#22456)ringabout2023-08-121-14/+5
| | | | | | | * better initialization patterns for seminst * Update compiler/seminst.nim * Update compiler/seminst.nim
* `initNodeTable` and friends now return (#22444)ringabout2023-08-111-5/+4
|
* Fix #21760 (#22422)SirOlaf2023-08-101-2/+2
| | | | | | | | | | | * Remove call-specific replaceTypeVarsN * Run for all call kinds and ignore typedesc * Testcase --------- Co-authored-by: SirOlaf <>
* use strictdefs for compiler (#22365)ringabout2023-08-061-1/+4
| | | | | | | | | | | | | | | * wip; use strictdefs for compiler * checkpoint * complete the chores * more fixes * first phase cleanup * Update compiler/bitsets.nim * cleanup
* fixes #22137 (#22170)Andreas Rumpf2023-06-271-1/+3
|
* fix calls in generic bodies, delay typecheck when no overloads match (#22029)metagn2023-06-131-2/+1
| | | | | | | | | | | | | | | | | | | | | | | * sacrifice "tgenericshardcases" for working statics * legacy switch for CI, maybe experimental later * convert to experimental * apparently untyped needs the experimental switch * try special case call semcheck * try fix * fix compilation * final cleanup, not experimental, make `when` work * remove last needed use of untyped * fix unused warning in test * remove untyped feature
* refactoring in preparation for better, simpler name mangling that wor… ↵Andreas Rumpf2023-04-241-6/+6
| | | | | | | | | | | (#21667) * refactoring in preparation for better, simpler name mangling that works with IC flawlessly * use new disamb field * see if this makes tests green * make tests green again
* fixes #21377; fixes `@[]` and `{}` type inference as returns in generics ↵ringabout2023-03-061-2/+9
| | | | | | | | | | | | | (#21475) * fixes `@[]` type inference in generics * add issue links * fixes macros and iterators * refactor * add one more test
* remove nosinks hacks from compiler (#21469)ringabout2023-03-041-1/+1
|
* replaces `pairs` with `keys` and `items`; saves 8 bytes (#21319)ringabout2023-02-021-1/+1
| | | replace `pairs` with `keys` and `items`
* fix #19882 Improve error message when instantiating generics that lac… ↵Bung2022-09-191-1/+2
| | | | | | | | | (#20356) * fix #19882 Improve error message when instantiating generics that lack a type * Update tests/errmsgs/t19882.nim Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* remove {.this.} pragma, deprecated since 0.19 (#20201)metagn2022-08-231-22/+2
| | | Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Fixed distinct composite type class proc borrowing (#18904)Jason Beetham2021-10-261-1/+5
| | | | | | | * Fixed composite type class proc borrowing * Moved borrow search into transf * added borrow check to symbol flag
* fixes #16246 (#18800)Andreas Rumpf2021-09-041-1/+2
|
* fixes #18030 (#18415)Andreas Rumpf2021-07-011-1/+1
|
* 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-0/+13
| | | | | * 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-23/+22
| | | | | | | | | | | | | * 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)
* use typeof instead type (#16962)flywind2021-02-081-2/+2
|
* IC: final implementation steps (#16801)Andreas Rumpf2021-01-251-1/+1
| | | | | | | | * 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-4/+4
| | | | | | | | | | | * 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 (#16550)Andreas Rumpf2021-01-071-2/+2
| | | | | | | | | | | | | | | | | | * 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-5/+8
| | | | | | | | | | | | | | | | | | | * 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-9/+9
| | | | | | | | | | | | | | | | | * 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)
* Big compiler Cleanup (#14777)Clyybber2020-08-281-1/+1
|
* avoid unsafe Nim features in preparation for --gc:arc (#14431)Andreas Rumpf2020-05-221-4/+4
|
* Make ./koch temp --gc:arc work (#14186)Clyybber2020-05-011-1/+1
|
* Cosmetic compiler cleanup (#12718)Clyybber2019-11-281-28/+28
| | | | | | | | | | | | | | | | | | * 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
* Fix spellings (#12277) [backport]Federico Ceratto2019-09-271-1/+1
|
* fixes #12051Araq2019-09-101-1/+1
|
* fixes #11515 (#11624)Andreas Rumpf2019-07-011-1/+1
| | | | | | * fixes #11515 * better fix for #11515; make tests green
* Replace countup(x, y-1) with x ..< yClyybber2019-05-071-3/+3
|
* more destructor based changes (#10885)Andreas Rumpf2019-03-231-1/+1
| | | | | | | | | | | * mark user defined destructors with sfOverriden to simplify the logic * refactoring in preparation to merge liftings and generic instantiations for destructors * ast: introduce nkHiddenTryStmt for destructor generation in order to be able to optimize better the code later on * renamed 'patterns' switch to 'trmacros' as it was totally misleading before * destructors: introduce tfCheckedForDestructor flag in preparation of strict =destroy checking * test for invalid/too late destructor introductions * liftdestructors: make code robust for nimsuggest * --newruntime works for hello world again * newruntime: code generation for closures
* gc:destructors: progressAndreas Rumpf2019-02-281-0/+2
|
* fixes nested gensym'ed parameters; fixes #9476Araq2018-12-081-1/+1
|
* IC: further progressAraq2018-12-011-2/+2
|
* Change the order of compilation passes, transformation is made lazy at code ↵cooldome2018-10-181-3/+2
| | | | | | | | | | | | | | | gen (#8489) * Ast no transformation * Add getImplNoTransform to the macros module * progress on delaying transf * Fix methods tranformation * Fix lazy lambdalifting * fix create thread wrapper * transform for lambda lifting * improve getImplTransformed * Fix destructor tests * try to fix nimprof for linux
* replace deprecated `safeAdd` with `add` (#9416)Miran2018-10-181-1/+1
|
* compiler: show name of instantiating context in error traces (#6763) (#9207)xzfc2018-10-111-1/+1
|
* fixes #4766Araq2018-08-281-1/+2
|
* WIP: disallow 'nil' for strings and seqsAndreas Rumpf2018-08-131-4/+3
|
* allow referencing other parameters in default parameter valuesZahary Karadjov2018-06-161-2/+24
| | | | | | | | fix #7756 fix #1201 fix #7000 fix #3002 fix #1046