summary refs log tree commit diff stats
path: root/compiler/semexprs.nim
Commit message (Collapse)AuthorAgeFilesLines
* Warn when casting to a larger type (#20103)konsumlamm2022-07-281-8/+10
| | | | | * Warn when casting to a larger type * Revert change to error message to fix CI
* 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>
* allow dots in defined() (#20010)metagn2022-07-121-1/+13
| | | | | | | * allow dots in defined() refs https://github.com/nim-lang/RFCs/issues/181 * mention accents in older versions
* Allow recursive closure iterators (#19939)Tanguy2022-06-301-1/+2
|
* Fix fixAbstractType for user defined typeclasses, fixes #19730 & #18409 (#19732)nc-x2022-04-301-1/+1
|
* Make sure that field usage preserves the original line info (#19751)Ivan Yonchovski2022-04-291-0/+2
| | | | Currently `struct.field` will generate a node with `info` that points to the symbol definition instead of having the actual node location.
* fix stylecheck bug with nre (#19356)flywind2022-04-081-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 * fix stylecheck bug with nre * Update compiler/linter.nim * no need to check dotexpr again * neither did let/var/const
* fixes #19603; some pragmas were really only supported as top level ↵Andreas Rumpf2022-03-261-1/+7
| | | | statements. Now this is enforced properly. (#19646)
* apply changes from #18017 and some fixes (#19571)flywind2022-03-011-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * implements https://github.com/nim-lang/RFCs/issues/369 * deprecate unsafeAddr; extend addr addr is now available for all addressable locations, unsafeAddr is deprecated and become an alias for addr * follow @Vindaar's advice * change the signature of addr * unsafeAddr => addr (stdlib) * Update changelog.md * unsafeAddr => addr (tests) * Revert "unsafeAddr => addr (stdlib)" This reverts commit ab83c99c507048a8396e636bf22d55fdd84d7d1c. * doc changes; thanks to @konsumlamm Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> * merge * remove * fix bug Co-authored-by: Araq <rumpf_a@web.de> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* Fixed object field access of static objects in generics (#19283) [backport]Jason Beetham2021-12-231-1/+1
|
* accept object type node from macros (#19179)hlaaftana2021-11-241-1/+1
|
* add ghci like type annotation buildEchoStmt (1049) (#18875)林亦恩2021-10-131-0/+1
| | | | | | | | | | | | * add ghci like type annotation buildEchoStmt (1049) * Update compiler/semexprs.nim * Update compiler/semexprs.nim Co-authored-by: flywind <xzsflywind@gmail.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: flywind <xzsflywind@gmail.com>
* alternative to #18918 (#18927)flywind2021-09-301-0/+2
| | | | | * fix #16558 * add testcase
* closes #16132 [backport] (#18880)Andreas Rumpf2021-09-221-5/+8
| | | | | * closes #16132 [backport] * fixes #16132 [backport]
* fixes #18856 [backport] (#18879)Andreas Rumpf2021-09-221-1/+1
|
* Fixed borrowing dot from aliases (#18854)Jason Beetham2021-09-161-2/+2
|
* Dotborrow now works with generic distincts (#18848)Jason Beetham2021-09-141-2/+2
|
* Generic pointer procs now error if no types supplied (#18832)Jason Beetham2021-09-111-1/+1
| | | | | | | * more precise logic for pointer procs * added test for generic pointer procs * Fixed generic getting bracket expr if erroring
* Fixes implicit and explicit generics in procedures (#18808)Jason Beetham2021-09-061-5/+23
| | | | | | | | | | | * Fixes implicit and explicit generics * moved block logic into 'maybeInstantiateGeneric' * Added more tests * Update compiler/semexprs.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* '[]' can now be used for iterators (#18814)Jason Beetham2021-09-061-1/+1
|
* implements https://github.com/nim-lang/RFCs/issues/407 (#18793)Andreas Rumpf2021-09-031-4/+12
|
* implements overloadable enum values; WIP (#18470)Andreas Rumpf2021-07-281-1/+35
| | | | | * implements overloadable enum values * simpler code
* refactoring: removed dead code (#18567)Andreas Rumpf2021-07-241-12/+7
|
* undo RFC #294, it breaks code for no good reason, the compiler can wa… ↵Andreas Rumpf2021-07-211-3/+1
| | | | | | | | | | | | | (#18546) * undo RFC #294, it breaks code for no good reason, the compiler can warn about the construct instead * Update changelog.md Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> * enable test case Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* improve `--declaredLocs` to help disambiguate types (generics, aliases etc) ↵Timothee Cour2021-07-081-1/+1
| | | | | | | | | (#18389) * improve --declaredlocs to help disambiguate types (generics, aliases etc) * avoid a cyclic deps * fix test after rebase
* fixes #16270 (#18388)Andreas Rumpf2021-06-291-0/+1
|
* add more APIs to compiler/debugutils; re-export it (#18243)Timothee Cour2021-06-181-0/+7
|
* Renamed `-d:nimCompilerStackraceHints` to `-d:nimCompilerStacktraceHints`. ↵Timothee Cour2021-06-171-2/+2
| | | | (#18283)
* fixes #15884 (#18230)Andreas Rumpf2021-06-101-1/+1
| | | | | * fixes #15884 * micro optimization
* fixes #18059 (#18140)Andreas Rumpf2021-06-021-2/+26
| | | | * fixes #18059
* feature: the compiler can warn when you use the implicit 'result' variable ↵Andreas Rumpf2021-05-101-0/+3
| | | | | (#17988) [backport:1.2] * implements #17855
* add colon (#17834)flywind2021-04-241-1/+1
|
* `typeof(voidStmt)` now works (#17807)Timothee Cour2021-04-231-1/+3
| | | | | | | | * `typeof(voidStmt)` now works * remove typeOrVoid * add condsyms, and reference cligen https://github.com/c-blake/cligen/pull/193 * fixup * changelog [skip ci] * fixup
* fix #7535(Poor error message for spawn when a procedure (without calling ↵flywind2021-04-211-2/+5
| | | | it)) (#17774)
* Revert localErrorNode param order changes (#17809)Clyybber2021-04-211-1/+1
| | | | | | | * Revert localErrorNode param order changes * Remove unused globalError overload * heh
* fix `hintMsgOrigin` regression + simplify msgs code (#17805)Timothee Cour2021-04-211-1/+1
|
* Introduce localErrorNode (#17785)Clyybber2021-04-191-4/+2
|
* cString => cSourceString; tyCString => tyCstring so that error msgs show ↵Timothee Cour2021-04-171-2/+2
| | | | cstring, not cString (#17744)
* Fix array's high & low return type for empty arrays (#17705)Tanguy Cizain2021-04-151-0/+2
| | | | | | | | | * fix array.high/low return type * Add test for empty array low return type Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* 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
* iterable[T] (#17196)Timothee Cour2021-04-111-2/+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
* fixes #17656 (#17657)Andreas Rumpf2021-04-071-1/+2
|
* implement RFCs/294 ; disallow enum <=> enum conversion (#16351)Timothee Cour2021-04-031-0/+5
| | | | | | | | | | | * fix https://github.com/nim-lang/RFCs/issues/294 ; disallow enum <=> enum conversion * fix the runnableExamples that was the instigator of this RFC * legacy -d:nimLegacyConvEnumEnum * use -d:nimLegacyConvEnumEnum in important_package nimgame2 * add test for enum cast * improve changelog * add changelog: Changes affecting backward compatibility * cleanup changelog * fix changelog
* IC: green tests (#17311)Andreas Rumpf2021-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * IC: renamed to_packed_ast module to ic module * IC: don't store the --forceBuild flag, makes it easier to test * IC: enable hello world test * Codegen: refactorings for IC; changed the name mangling algorithm * fixed the HCR regressions * life is too short for HCR * tconvexhull is now allowed to use deepCopy * IC exposed a stdlib bug, required a refactoring * codegen: code cleanups * IC: even if a module is outdated, its dependencies might come from disk * IC: progress * IC: better name mangling, module IDs are not stable * IC: another refactoring helping with --ic:on --gc:arc * disable arraymancer on Windows for the time being * disable arraymancer altogether * IC: make basic test work with 'nim cpp' * IC: progress on --ic:on --gc:arc * wip; name mangling for type info
* 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-2/+9
| | | | | * fixes #11225; generic sandwich problems; [backport:1.2] * progress * delegating these symbols must be done via 'bind'
* Fix macros.quote custom op symbol interpolation. (#17256)quantimnot2021-03-051-9/+19
| | | | | | | | | | Provides a workaround/fix for #7589. https://github.com/nim-lang/Nim/issues/7589 Updated docs and tutorial to reflect change. Updated runnableExamples to include an example. Co-authored-by: name <name@example.com>
* when statements branches exit early (#17143)Saem Ghani2021-02-221-0/+1
| | | | | When statement branches exit early outside of nimvm. In nimvm it seems that all sides of the branches must be evaluated as the code gen happens at a later stage, this remains intact.
* fixed dot operator recursive loop & macro suggest (#16922)Saem Ghani2021-02-151-1/+17
| | | | | | | | | | | | | | | | | | * basic stability improvements; refs nimsuggest * fixed dot operator recursive loop & macro suggest * hacky fix for run away dot operator sem check Committing this mostly to make the issue more clear. Perhaps get better feedback. * semExprWithType seems like a better place to check * fixed error messages const case expressions * Clean-up test * stopped the dot operator madness No longer get infinite recursion when seming broken code with a dot operator macro like in jsffi. Co-authored-by: Araq <rumpf_a@web.de>
* use typeof instead type (#16962)flywind2021-02-081-1/+1
|