summary refs log tree commit diff stats
path: root/compiler/semgnrc.nim
Commit message (Collapse)AuthorAgeFilesLines
* fixes addr/hiddenAddr in strictdefs (#23477)ringabout2024-04-101-1/+1
|
* add switch, warning, and `bind` support for new generic injection behavior ↵metagn2023-12-221-4/+7
| | | | | | | | | | | | | | | | | | | | | (#23102) refs #23091, especially post merge comments Unsure if `experimental` and `bind` are the perfect constructs to use but they seem to get the job done here. Symbol nodes do not get marked `nfOpenSym` if the `bind` statement is used for their symbol, and `nfOpenSym` nodes do not get replaced by new local symbols if the experimental switch is not enabled in the local context (meaning it also works with `push experimental`). However this incurs a warning as the fact that the node is marked `nfOpenSym` means we did not `bind` it, so we might want to do that or turn on the experimental switch if we didn't intend to bind it. The experimental switch name is arbitrary and could be changed. --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* allow replacing captured syms in macro calls in generics (#23091)metagn2023-12-181-0/+13
| | | | | | | | | | | | | | | | | | fixes #22605, separated from #22744 This marks symbol captures in macro calls in generic contexts as `nfOpenSym`, which means if there is a new symbol in the local instantiatied body during instantiation time, this symbol replaces the captured symbol. We have to be careful not to consider symbols outside of the instantiation body during instantiation, because this will leak symbols from the instantiation context scope rather than the original declaration scope. This is done by checking if the local context owner (maybe should be the symbol of the proc currently getting instantiated instead? not sure how to get this) is the same as or a parent owner of the owner of the replacement candidate symbol. This solution is distinct from the symchoice mechanisms which we originally assumed had to be related, if this assumption was wrong it would explain why this solution took so long to arrive at.
* fixes yet another strictdefs bug (#23069)ringabout2023-12-151-6/+8
|
* case macro now can be used inside generic. Fixes #20435 (#22752)Juan M Gómez2023-09-301-1/+15
| | | | | | | | | fixes #20435 --------- Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> Co-authored-by: Jake Leahy <jake@leahy.dev> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* implement semgnrc for tuple and object type nodes (#22709)metagn2023-09-161-2/+41
| | | fixes #22699
* block ambiguous type conversion dotcalls in generics (#22375)metagn2023-08-091-0/+11
| | | fixes #22373
* use strictdefs for compiler (#22365)ringabout2023-08-061-1/+2
| | | | | | | | | | | | | | | * wip; use strictdefs for compiler * checkpoint * complete the chores * more fixes * first phase cleanup * Update compiler/bitsets.nim * cleanup
* retain forced open undeclared ident information (#22019)metagn2023-06-071-1/+1
|
* when T is both a type symbol and a routine symbol in scope of a generic proc ↵metagn2023-05-241-4/+6
| | | | | do not account for the type symbol when doing `a.T()` (#21899) fix #21883
* fix #14254 (#21837)metagn2023-05-201-2/+6
| | | | | | | * fix #14254 * use temporary PR branch for neo * fix url
* make deprecated statement a no-op (#21836)metagn2023-05-121-2/+2
|
* consistent use of scForceOpen for generic dot field symbols (#21738)metagn2023-05-051-11/+11
| | | | | | | | | | | | | | | | | | | | | * always force open generic dot field symbols? fixes #21724 but might break code * alternative, should fix CI * other alternative, add test for previous CI failure * not needed * make sure call doesn't compile too * ok actual second test * ok final actual correct test * apply performance idea * don't make fromDotExpr static
* refactoring in preparation for better, simpler name mangling that wor… ↵Andreas Rumpf2023-04-241-1/+1
| | | | | | | | | | | (#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
* alias syntax fixes, improvements and tests (#21671)metagn2023-04-221-33/+14
| | | | | | | | | | | | | * alias syntax fixes, improvements and tests * even better, cannot use alias syntax with generics * more type tests, improve comment * fix again * consistent error message + make t5167_5 work * more comments, remove {.noalias.}
* fixes #3770; templates with untyped parameters resolve private fields ↵ringabout2023-03-211-0/+22
| | | | | | | | | wrongly in generics (#21554) * fixes #3770; templates with untyped parameters resolve private fields wrongly * add a test case for #3770 * rename to `nfSkipFieldChecking`
* fixes #20572 (#20585)Andreas Rumpf2022-10-171-1/+1
| | | | | * fixes #20572 * added a test case
* overloadable enums no longer experimental (#20298)metagn2022-09-051-5/+1
| | | depends on #20126
* Change `styleCheck` to ignore foreign packages (#19822)quantimnot2022-07-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* fixes #18769 (#18790)Andreas Rumpf2021-09-031-1/+7
|
* Fixed const tuples in inferred generics (#18598)Jason Beetham2021-07-271-17/+16
|
* refactoring: removed empty withBracketExpr template (#18152)Andreas Rumpf2021-06-021-4/+2
|
* fix #17941: UnusedImport works for var/let/const/type invoked inside a ↵Timothee Cour2021-05-081-0/+3
| | | | | | | generic (#17942) * fix #17941: UnusedImport works for var/let/const/type invoked inside a generic * fixup
* potential fix for semgeneric formal params (#17494)Saem Ghani2021-03-241-2/+4
| | | | marked locations where analysis of return formal param is done prior to args. This might fix some subtle bugs.
* 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>
* refactorings to prepare the compiler for IC (#15935)Andreas Rumpf2020-12-171-5/+7
| | | | | | | | | | | | | | * 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
* explicit ID generation for easier IC (#15559)Andreas Rumpf2020-10-251-5/+5
| | | | | | | | | | | | | | | | | * 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)
* 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
* fix bug in semgnrc: runnableExamples should not semcheck, even with > 1 arg ↵Timothee Cour2020-06-231-1/+1
| | | | (#14768)
* implement the 'bind' statement for generics, it was an oversight that this ↵Andreas Rumpf2020-06-071-4/+11
| | | | was never implemented (#14584)
* fix #13524 astToStr now works inside generics (#13681)Timothee Cour2020-03-181-1/+1
|
* make case-object transitions explicit, make unknownLineInfo a const, replace ↵Jasper Jenkins2020-01-171-1/+1
| | | | a few magic numbers with consts (#13170)
* Cosmetic compiler cleanup (#12718)Clyybber2019-11-281-117/+111
| | | | | | | | | | | | | | | | | | * 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
* Small ast.nim cleanup (#12156)Clyybber2019-09-091-21/+21
| | | | | * Remove sonsLen * Use Indexable
* refs #11947; FieldError fixed (#11950)Timothee Cour2019-08-151-1/+1
|
* styleCheck: make the compiler and large parts of the stdlib compatible with ↵Araq2019-07-101-2/+2
| | | | --styleCheck:error
* fixes #11188 (#11319)Andreas Rumpf2019-05-241-2/+2
|
* Replace countup(x, y) with x .. yClyybber2019-05-071-6/+6
|
* Replace countup(x, y-1) with x ..< yClyybber2019-05-071-15/+15
|
* 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
* Fixes #10727. (#10728)deech2019-02-251-1/+6
|
* added first version of a nimfind tool for the poor souls that don't have a ↵Andreas Rumpf2018-11-141-11/+12
| | | | good nimsuggest integretation
* fixes #8603Araq2018-10-301-1/+8
|
* Fix regression with runnableExamples in generic exprLemonBoy2018-09-301-5/+5
| | | | | | | | The examples should not enter the generic analysis at all. The regression was introduced in 4cf704bb as a fix for #8694. Fixes #9130 Fixes #8694
* fixes #8694Andreas Rumpf2018-09-021-2/+2
|
* Fix use of custom pragmas in generic procs (#8165)LemonBoy2018-07-011-1/+2
| | | Fixes #7626
* fixes #7222; fixes #5595; fixes #3747Zahary Karadjov2018-06-161-11/+20
| | | | | | | | | | * late instantiation for the generic procs' default param values * automatic mixin behaviour in concepts Other fixes: * don't render the automatically inserted default params in calls * better rendering of tyFromExpr
* implements a --nep1:on switch to make the compiler enforce the naming ↵Andreas Rumpf2018-06-131-1/+1
| | | | conventions outlined in NEP-1
* refactoring: remove idents.legacy global variable and pass the IdentCache ↵Andreas Rumpf2018-05-271-8/+8
| | | | around explicitly