summary refs log tree commit diff stats
path: root/compiler/semcall.nim
Commit message (Collapse)AuthorAgeFilesLines
* fixes addr/hiddenAddr in strictdefs (#23477)ringabout2024-04-101-4/+4
|
* refactoring: no inheritance for PType/PSym (#23403)Andreas Rumpf2024-03-141-1/+1
|
* improve error messages [backport] (#23345)ringabout2024-02-261-34/+79
| | | | | | ref https://forum.nim-lang.org/t/11052 ![image](https://github.com/nim-lang/Nim/assets/43030857/1df87691-32d9-46b5-b61b-6b9f7cc94862)
* Fixes a nimsuggest crash when using chronos (#23293)Juan M Gómez2024-02-201-2/+1
| | | | | | | | | | | | | | | The following would crash nimsuggest on init: ```nim import chronos type HistoryQuery = object start: int limit: int HistoryResult = object messages: string type HistoryQueryHandler* = proc(req: HistoryQuery): Future[HistoryResult] {.async, gcsafe.} ```
* types refactoring; WIP (#23086)Andreas Rumpf2023-12-171-5/+6
|
* Overloads passed to static proc parameters now convert to the desired… ↵Jason Beetham2023-12-141-4/+10
| | | | | (#23063) … type mirroring proc params
* type refactoring: part 2 (#23059)Andreas Rumpf2023-12-131-3/+3
|
* Types: Refactorings; step 1 (#23055)Andreas Rumpf2023-12-121-3/+3
|
* Look up generic parameters when found inside semOverloadedCall, fixin… ↵Jason Beetham2023-12-121-0/+13
| | | | | | | | | (#23054) …g static procs --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #22902; borrow from proc return type mismatch (#22908)ringabout2023-11-041-1/+1
| | | fixes #22902
* unify explicit generic param semchecking in calls (#22618)metagn2023-09-011-2/+6
| | | fixes #9040
* `initCandidate` and friends now return values (#22570)ringabout2023-08-281-4/+4
| | | | | | | | | * `initCandidate` and friends now return values * fixes semexprs.nim * fixes semcall.nim * Update compiler/semcall.nim
* fix generic param substitution in templates (#22535)metagn2023-08-251-1/+6
| | | | | | | * fix generic param substitution in templates fixes #13527, fixes #17240, fixes #6340, fixes #20033, fixes #19576, fixes #19076 * fix bare except in test, test updated packages in CI
* unpublic the sons field of PType; the precursor to PType refactorings (#22446)ringabout2023-08-111-3/+2
| | | | | | | | | | | * unpublic the sons field of PType * tiny fixes * fixes an omittance * fixes IC * fixes
* fix #19304 Borrowing std/times.format causes Error: illformed AST (#20659)Bung2023-08-101-14/+30
| | | | | | | | | * fix #19304 Borrowing std/times.format causes Error: illformed AST * follow suggestions * mitigate for #4121 * improve error message
* use strictdefs for compiler (#22365)ringabout2023-08-061-5/+11
| | | | | | | | | | | | | | | * wip; use strictdefs for compiler * checkpoint * complete the chores * more fixes * first phase cleanup * Update compiler/bitsets.nim * cleanup
* Let inferGenericTypes continue if a param is already bound (#22384)SirOlaf2023-08-061-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Play with typeRel * Temp solution: Fixup call's param types * Test result type with two generic params * Asserts * Tiny cleanup * Skip sink * Ignore proc * Use changeType * Remove conversion * Remove last bits of conversion * Flag --------- Co-authored-by: SirOlaf <>
* Add experimental inferGenericTypes switch (#22317)SirOlaf2023-08-031-4/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Infer generic bindings * Simple test * Add t * Allow it to work for templates too * Fix some builds by putting bindings in a template * Fix builtins * Slightly more exotic seq test * Test value-based generics using array * Pass expectedType into buildBindings * Put buildBindings into a proc * Manual entry * Remove leftover ` * Improve language used in the manual * Experimental flag and fix basic constructors * Tiny commend cleanup * Move to experimental manual * Use 'kind' so tuples continue to fail like before * Explicitly disallow tuples * Table test and document tuples * Test type reduction * Disable inferGenericTypes check for CI tests * Remove tuple info in manual * Always reduce types. Testing CI * Fixes * Ignore tyGenericInst * Prevent binding already bound generic params * tyUncheckedArray * Few more types * Update manual and check for flag again * Update tests/generics/treturn_inference.nim * var candidate, remove flag check again for CI * Enable check once more --------- Co-authored-by: SirOlaf <> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fix scoping regression with calls in generic bodies (#22115)metagn2023-06-171-1/+1
| | | refs #22029, refs https://github.com/status-im/nim-libp2p/actions/runs/5263850340/jobs/9514434659
* fix calls in generic bodies, delay typecheck when no overloads match (#22029)metagn2023-06-131-1/+4
| | | | | | | | | | | | | | | | | | | | | | | * 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
* hopefully easier to understand error message (#21585)Andreas Rumpf2023-03-301-2/+2
|
* mitigates #21272; but it's not the final fix because the first round … ↵Andreas Rumpf2023-03-201-2/+2
| | | | | (#21462) mitigates #21272; but it's not the final fix because the first round of overload resolution should already match
* Fix #21272: Rewrite parts of pickBestCandidate (#21465)SirOlaf2023-03-051-36/+50
| | | | | | | | | | | | | | | * Make pickBestCandidate store syms * Remove useless cursor * Try making pickBestCandidate more readable * Fix advance order * Revert back to seq with lots of comments --------- Co-authored-by: SirOlaf <>
* remove nosinks hacks from compiler (#21469)ringabout2023-03-041-1/+1
|
* less verbose type mismatch messages (#21191)ringabout2022-12-281-10/+34
| | | | | | | | | * less verbose type mismatch messages * Update compiler/types.nim * fixes i386 * fixes i386
* fix bugs with dot & call operators [backport] (#20931)metagn2022-11-281-25/+33
| | | | | | | | | | | | | | | | | | | * better error messages for dot operators [backport] fixes #13063 * also fixes #7777 * fix #6981 and #9831 too * fix * minor improvement * sus test fixes * make test multiplatform lol * fix nimsuggest test, extra improvements
* fix semcase on tySequence and tyObject #20283 #19682 (#20339)Bung2022-11-011-0/+3
| | | | | | | | | | | | | * fix semcase on tySequence and tyObject #20283 #19682 * use better arg name * avoiding returns nil use errorNode instead, clean code * use efNoDiagnostics flag * remove tests/errmsgs/t19682.nim * combine 2 test cases to one file
* 'lock levels' are deprecated, now a noop (#20539)ringabout2022-10-111-3/+0
| | | | | * 'lock levels' are deprecated, now a noop * fixes tests
* Automatic dereferencing is removed (#20531)ringabout2022-10-101-21/+0
|
* store full definition AST for consts, fix noRewrite (#20115)metagn2022-09-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | * continue #9582 for consts, close #9331, fix #20114 also move extractPragma to ast to pave the way for things like {.strdefine: "abc".} etc * changelog correctly * fix jsgen * update tgetimpl * fix sighashes * fix #19766, add comment about postfix * fix noRewrite LOL refs #16620 * fix changelog * fix destructors
* remove {.this.} pragma, deprecated since 0.19 (#20201)metagn2022-08-231-16/+0
| | | Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* .forbids pragma: defining forbidden tags (#20050)Lancer112112022-07-261-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * .forbids pragma: defining illegal effects for proc types This patch intends to define the opposite of the .tags pragma: a way to define effects which are not allowed in a proc. * updated documentation and changelogs for the forbids pragma * renamed notTagEffects to forbiddenEffects * corrected issues of forbids pragma the forbids pragma didn't handle simple restrictions properly and it also had issues with subtyping * removed incorrect character from changelog * added test to cover the interaction of methods and the forbids pragma * covering the interaction of the tags and forbids pragmas * updated manual about the forbids pragma * removed useless statement * corrected the subtyping of proc types using the forbids pragma * updated manual for the forbids pragma * updated documentations for forbids pragma * updated nim docs * updated docs with rsttester.nim * regenerated documentation * updated rst docs * Update changelog.md Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> * updated changelog * corrected typo Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* Fixed distinct composite type class proc borrowing (#18904)Jason Beetham2021-10-261-2/+11
| | | | | | | * Fixed composite type class proc borrowing * Moved borrow search into transf * added borrow check to symbol flag
* strict effects (#18777)Andreas Rumpf2021-09-021-0/+2
| | | | | | | | | | | | | | | | | * 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
* fix a typo (#18715)flywind2021-08-191-1/+1
|
* improve `--declaredLocs` to help disambiguate types (generics, aliases etc) ↵Timothee Cour2021-07-081-7/+5
| | | | | | | | | (#18389) * improve --declaredlocs to help disambiguate types (generics, aliases etc) * avoid a cyclic deps * fix test after rebase
* Make procedure mismatch more informative with pragma/call convention ↵Jason Beetham2021-07-061-1/+7
| | | | | | | | | | | | | | | | | | mismatches (#18384) * Added more concise calling convention/pragma mismatch messages * Now only adds callConvMsg/lock message when sensible * Fixed message formatting * Added tests, and fixed some bugs * Tests joined, and always indenting * More tests and more bug fixes * Fixed first test in tprocmismatch * Using var param for writting mismatches * Better logic for handling proc type rel and conv/pragma mismatch * Refactored getProcConvMismatch * Fixed callConv message formatting * Fixed test for proper message * Cleanup to address issues * getProcConvMismatch now returns tuple, and reformatted code
* followup #17777: declaredloc field error msgs now work with generics (#18259)Timothee Cour2021-06-141-2/+3
| | | | | | | * followup #17777: declaredloc field error msgs now work with generics * fix tests * cleanup
* more informative error msg for undeclared field (`A(badfield: 1)` and ↵Timothee Cour2021-05-161-2/+13
| | | | `a.badfield = expr`) (#17777)
* iterable[T] (#17196)Timothee Cour2021-04-111-3/+7
| | | | | | | | * fix failing test toSeq in manual which now works * changelog * reject proc fn(a: iterable) * add iterable to spec * remove MCS/UFCS limitation that now works
* semLambda removed, semProcAux reworked (#17379)Saem Ghani2021-03-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* fix #2844 #3911; add --spellsuggest to suggest symbols in scope with similar ↵Timothee Cour2021-03-161-0/+1
| | | | | | | spellings on undefined symbol error (#16067) * add --spellsuggest to suggest symbols in scope with similar spellings on undefined symbol errors * implement --spellsuggest with 0 arguments
* IC: next steps (#16729)Andreas Rumpf2021-01-231-2/+2
| | | | | | | | | | | * 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
* fix #16150 improve type mismatch errors (#16152)Timothee Cour2020-12-091-1/+1
| | | | | | | * fix #16150 improve type mismatch errors * allow -d:nimLegacyTypeMismatch * address comment
* Correct all eggs (#15906)Miran2020-11-101-1/+1
| | | | * "eg" is a misspelled "egg", "e.g." is "exempli gratia" * Also, "ie" is "i.e.".
* honor --declaredLocs in more places, including type mismatch errors; also ↵Timothee Cour2020-10-271-6/+3
| | | | | | | show `kind` with --declaredLocs (#15673) * honor --declaredLocs in more places, including type mismatch errors * fix tests * show declaration location also when type mismatch names clash
* explicit ID generation for easier IC (#15559)Andreas Rumpf2020-10-251-2/+2
| | | | | | | | | | | | | | | | | * 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)
* add --declaredlocs (#15666)Timothee Cour2020-10-211-6/+5
|
* fixes bootstrapping for any machine that has a Nim already installed ↵Andreas Rumpf2020-10-201-0/+7
| | | | [backport:1.4] (#15660)
* don't raise index defects on malformed ast (#15278)Andy Davidoff2020-09-071-3/+8
| | | | | * don't raise index defects on malformed ast * style