summary refs log tree commit diff stats
path: root/compiler/sem.nim
Commit message (Collapse)AuthorAgeFilesLines
* fixes 'lent T' inside object constructor [backport] (#18911)Andreas Rumpf2021-09-271-1/+2
| | | | | * fixes 'lent T' inside object constructor [backport] * progress
* Fixed type inference for 'set` and 'tuple' (#18827)Jason Beetham2021-09-111-1/+2
| | | | | | | * improved built in typeclass inference * Smarter logic to fit node * Forgot the untyped check
* fixes #12642 (#18811)Andreas Rumpf2021-09-061-0/+6
| | | | | | | | | | | | | | | | | | | * fixes #12642 * update important packages; refs #18804 * fixes #18805; refs #18806 * fixes a regression * Update testament/categories.nim Co-authored-by: flywind <xzsflywind@gmail.com> * progress * progress Co-authored-by: flywind <xzsflywind@gmail.com>
* strict effects (#18777)Andreas Rumpf2021-09-021-3/+4
| | | | | | | | | | | | | | | | | * fixes #17369 * megatest is green for --cpu:arm64 * docgen output includes more tags/raises * implemented 'effectsOf' * algorithm.nim: uses new effectsOf annotation * closes #18376 * closes #17475 * closes #13905 * allow effectsOf: [a, b] * added a test case * parameters that are not ours cannot be declared as .effectsOf * documentation * manual: added the 'sort' example * bootstrap with the new better options
* implements overloadable enum values; WIP (#18470)Andreas Rumpf2021-07-281-0/+8
| | | | | * implements overloadable enum values * simpler code
* fixes #15884 (#18230)Andreas Rumpf2021-06-101-0/+9
| | | | | * fixes #15884 * micro optimization
* add astmsgs; add `declared in` msg for usage lint errors (#17961)Timothee Cour2021-05-081-1/+1
| | | | | | | | | * add astmsgs; add `declared in` msg for usage lint errors * fix test * fix tests/tools/tlinter.nim * std prefix
* `typeof(voidStmt)` now works (#17807)Timothee Cour2021-04-231-0/+1
| | | | | | | | * `typeof(voidStmt)` now works * remove typeOrVoid * add condsyms, and reference cligen https://github.com/c-blake/cligen/pull/193 * fixup * changelog [skip ci] * fixup
* Introduce localErrorNode (#17785)Clyybber2021-04-191-2/+1
|
* IC: first steps towards 'nim check --def --ic:on' (#17714)Andreas Rumpf2021-04-141-0/+1
| | | | | | | | | * IC: first steps towards 'nim check --def --ic:on' * IC navigator: deduplicate output lines * IC navigator: progress * IC navigator: use a different nimcache entry * IC navigator: special logic for templates/macros * IC navigator: proper error messages * IC navigator: prepare for testing code; document only what currently works somewhat
* IC: backend: remember produced type information (#17440)Andreas Rumpf2021-03-231-1/+1
|
* semTemplateDef and t17433 clean-ups (#17448)Saem Ghani2021-03-221-2/+22
| | | | | - 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-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* 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)
* use typeof instead type (#16962)flywind2021-02-081-1/+1
|
* IC: bugfixes (WIP) (#16836)Andreas Rumpf2021-02-021-0/+1
| | | | | | | | * 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 (#16729)Andreas Rumpf2021-01-231-6/+6
| | | | | | | | | | | * 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-0/+2
| | | | | | | | | | | * 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-1/+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-10/+10
| | | | | | | | | | | | | | | | | | | * 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-3/+5
| | | | | | | | | | | | | | * 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
* 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)
* Revert "fixes #15280 [backport:1.2] (#15281)" (#15700)Clyybber2020-10-241-1/+1
| | | This reverts commit 3f00a738dbc8319b4dd2b86bf5529c096f2dd243.
* fixes #15280 [backport:1.2] (#15281)Andreas Rumpf2020-09-091-1/+1
| | | | | | | * fixes #15280 [backport:1.2] * make tests green again * adapt tests
* borrow checking (#15282)Andreas Rumpf2020-09-091-5/+5
| | | | | | | | | | | * 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
* Fix #5691 (#15158)Clyybber2020-08-271-8/+5
| | | | | | | | * 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-1/+2
| | | | | | | | | | | | | | | | | | | | | | | * 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
* 'isolate' builtin; refs https://github.com/nim-lang/RFCs/issues/244 (#15011)Andreas Rumpf2020-07-201-1/+2
|
* misc cleanups in compiler msgs: use toHumanStr, etc (#14677)Timothee Cour2020-06-151-4/+2
|
* * honor --errorMax even for tools (eg drnim, nim doc) (#14546)Timothee Cour2020-06-021-1/+1
| | | * fix a bug that prevented nim doc compiler/nim on windows
* disallow typedesc in arrays & move existing checks to `types.typeAllowedAux` ↵Neelesh Chandola2020-05-291-5/+7
| | | | | | (#13261) * disallow typedesc in arrays and move previous checks to types.typeAllowedAux
* Make ./koch temp --gc:arc work (#14186)Clyybber2020-05-011-2/+5
|
* implement (#14114)cooldome2020-04-251-8/+3
| | | Co-authored-by: cooldome <ariabushenko@bk.ru>
* The raises list can now use expressions referencing the generic paramsZahary Karadjov2020-04-011-0/+1
|
* Replace tfHasRequiresInit with a more accurate mechanismZahary Karadjov2020-04-011-1/+3
| | | | | | | | | 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).
* Perform nil checks during object construction and within compiles()Zahary Karadjov2020-04-011-1/+1
| | | | Close https://github.com/nim-lang/Nim/issues/6494
* Plug another hole: default(T) forbidden for objects requiring initializationZahary Karadjov2020-04-011-18/+1
|
* Don't allow 'var x: T' for objects that require initializationZahary Karadjov2020-04-011-0/+18
|
* EndsInNoReturn in expressions extension, fixes #13490 (#13520)cooldome2020-02-281-1/+1
| | | | * fix #13490
* fixes #12627 (#13521)cooldome2020-02-281-1/+1
| | | | * fixes #12627
* make case-object transitions explicit, make unknownLineInfo a const, replace ↵Jasper Jenkins2020-01-171-1/+1
| | | | a few magic numbers with consts (#13170)
* remove all remaining warnings when build nim (with -d:nimHasLibFFI) (#13084)Timothee Cour2020-01-091-1/+1
| | | | | | * cleanup deprecations in evalffi + elsewhere * remove dead code getOrdValue64
* Cosmetic compiler cleanup (#12718)Clyybber2019-11-281-18/+17
| | | | | | | | | | | | | | | | | | * 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-1/+1
| | | | | * Remove sonsLen * Use Indexable
* fixes #11941 (#12079)Andreas Rumpf2019-08-291-2/+7
|
* lift destructor for openarray (#12073)cooldome2019-08-281-6/+4
| | | | * destroy for sink openarray
* Fix several float range issues (supersedes #11905) (#12067)Andreas Rumpf2019-08-271-0/+1
|\ | | | | | | | | | | * Fix several float range issues * address the comments
| * address the commentsnarimiran2019-08-271-0/+1
| |
* | fixes #12029; finish the 'unused import' feature (#12064)Andreas Rumpf2019-08-271-1/+2
|/